Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Better Fix than "route add default gw"?

Status
Not open for further replies.

xweyer

MIS
Sep 7, 2000
140
US
I'm new to Linux and have just finished working through a fairly lengthly process of getting my laptops wireless card working with ndiswrapper (two nics and two routers involved).

At this point everything is working great except that each time I want to use the wireless card I have to open a root shell and issue a "route add default gw 192.168.0.1" command before I can get to the internet.

Related to this I have a three part question.

1. Is there a configuration file I can enter this value into to make the fix permanent between sessions?

2. Failing that, is there a way to automate the process of issuing the command in kde? (It has to occur after the desktop has loaded or the network isn't found).

3. If the other two options are NG, is there a way to get an icon on the desktop that would issue the command when clicked? (I tried this myself but the command isn't executed. I'm guessing this is because route requires root privileges? [The process I used was creating a file "Get_Net.sh" on the desktop containing the command "bash route add default gw 192.168.0.1", Then I right clicked and made it executable.])
 
what is you linux distro? it may change between them.

redhat has files in /etc/sysconfig in order to set the networks, debian-based distros have /etc/network, etc.

Cheers.

Chacal, Inc.
 
Opps. I should have included that. It's SUSE 9.2
 
I haven't used SuSE since version 6.0, so I can't really help you with #1. However, regarding the other two:

2) KDE has an "Autostart" folder for each user. It is usually located someplace like $HOME/.kde/Autostart (its location is configurable per user). Any executable files placed in this directory will be automatically run when you log in.

3) Yes, you'll need to run that as root. The method you tried should work fine (though you might want to use the full path to route, since if might not be in your $PATH), except that you'll need to use kdesu or sudo to get root access when you run the command. Kdesu is probably the easiest to get working, but with a little configuration, you can set up sudo to not require a password.
 
To sudo without password:
Assuming your name is xweyers and your hostname is xwpc, as root add to the sudoers file:
Code:
xweyers xwpc=NOPASSWD: /usr/local/bin/gateway.sh

For running the command on EVERY boot, I would modify /etc/init.d/networking (and make sure it's called in my prefered runlevel(s).

seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top