what is the function to call on dhcp?

Issues Related to Networking (Wired and Wireless)

Moderator: Moderators

what is the function to call on dhcp?

Postby soloingbastard » Mon Sep 24, 2007 18:38

Hey everyone, everytime i want to use the internet i go through some insanley long procedure which takes ages, so i figured it would be a good idea to create a small script that would do the majority of the typing for me. I've created this small script, which works just fine except for the fact that to connect to my network i need dhcp to find an IP adress and i don't know how to do that in code, any help on the subject would be much appreciated.

Code: Select all
modprobe rt2570
ifconfig rausb0 up
iwconfig rausb0 essid Redington
iwconfig rausb0 key open 3030-3431-3431-3731-3138-3737-35
[b]what is the function for dhcp???[/b]


also, how could i make it that when i double click on it, it asks me to run as root and then executes itself?
thnx.
soloingbastard
Young Hen
 
Posts: 34
Joined: Mon May 21, 2007 20:39

Re: what is the function to call on dhcp?

Postby Fitzcarraldo » Mon Sep 24, 2007 19:00

Can't help you with the DHCP function, but to answer your other question:
1. Create a Desktop Config File (right-click on your desktop and select Create New > Link to Application...
2. Click on the Application tab and enter the relevant command in the Command box, e.g.
Code: Select all
sh /home/soloingbastard/<file name of shell script>

(assuming you've put the shell script in /home/soloingbastard, of course)
3. Click on Advance Options and then Run as a different user and enter "root" (without the quotes) in the Username box
4. I would also optionally tick Run in terminal and Enable launch feedback
5. Click on the icon on the General tab and select an icon you like

The above would prompt you to enter the root password when you double-click on the icon on the desktop. Alternatively, you could type "sudo" before the rest of the command in the Command box and not tick Run as a different user, and you would then be prompted to enter your password as you would if you had typed "sudo" interactively.
Last edited by Fitzcarraldo on Mon Sep 24, 2007 19:04, edited 2 times in total.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7998
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: what is the function to call on dhcp?

Postby WarraWarra » Mon Sep 24, 2007 19:02

Not sure what version of Sabayon you are using but most of them just right click the knetworkmanager top right next to time and select wireless network and connect.

If you have to manually load the rtl driver see "before 3.4e ipw3945....." post / sticky in networking part of the forums this should have all the info + rc-update and others to make it auto on during boot.
WarraWarra
Sagely Hen
 
Posts: 1989
Joined: Wed Jan 03, 2007 21:01
Location: 31.324270, -113.585511

Re: what is the function to call on dhcp?

Postby soloingbastard » Mon Sep 24, 2007 19:48

o.k thank-you very much for everything! especially Fitzcarraldo who said how to make one click connect to the shell script and run as root.

For any of you interested, the dunction is simply
"dhclient"

here's the final code
Code: Select all
modprobe rt2570
ifconfig rausb0 up
iwconfig rausb0 essid Redington
iwconfig rausb0 key open 3030-3431-3431-3731-3138-3737-35
dhclient


any queries PM me.
soloingbastard
Young Hen
 
Posts: 34
Joined: Mon May 21, 2007 20:39

Re: what is the function to call on dhcp?

Postby arjay » Sun Sep 30, 2007 21:57

You can also type:
Code: Select all
dhcpcd wlan0 (or eth0 or eth1 (whichever your wireless is linked to)


for those not using dhclient.
arjay
Simple Hen
 
Posts: 75
Joined: Thu Aug 24, 2006 22:03
Location: ~/earth


Return to Networking and Wireless

Who is online

Users browsing this forum: No registered users and 2 guests