View previous topic :: View next topic |
Author |
Message |
tuppe666 Guru


Joined: 02 Mar 2004 Posts: 423
|
Posted: Sat Mar 24, 2007 1:55 am Post subject: Want to replace ifconfig/route wit real startup files[solved |
|
|
I currently use my Linux PC as my Gateway to the internet, and connect my Windows XP machine through this. I works quite well. I'm not very good in this area, and spent a long time getting it working.
I now type.
Code: |
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
route add -net 192.168.1.0 netmask 255.255.255.0 eth0
|
I really need to do this properly, as I went out last weekend and had to have my girlfriend type this in over the phone. Needless to say she wasn't happy.
Last edited by tuppe666 on Tue Mar 27, 2007 1:32 pm; edited 1 time in total |
|
Back to top |
|
 |
didymos Advocate


Joined: 10 Oct 2005 Posts: 4798 Location: California
|
Posted: Sat Mar 24, 2007 5:27 am Post subject: |
|
|
See /etc/conf.d/net.example for how to set this stuff up as a startup service. Plus, once it's configured, you don't need to run things at startup if you don't want to. You could have the LAN stuff set up during boot, for example, but manually connect to the internet. Just don't add the startup script for your internet connection to the default runlevel (actually, all interface scripts except the loopback are symlinks to /etc/init.d/net.lo, but the script checks which name it was called as in order to figure out what settings/devices to configure. Just check the example file and the Gentoo handbook and you'll see how it works). _________________ Thomas S. Howard |
|
Back to top |
|
 |
erik258 Advocate


Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
Posted: Sat Mar 24, 2007 5:28 am Post subject: |
|
|
this is actually really easy. create a file /etc/conf.d/net with the line
/etc/conf.d/net: | config_eth0=( "192.168.1.1 netmask 255.255.255.0" ) |
perhaps you need help getting both interfaces set up automatically, if it's a router? _________________ Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit!
Last edited by erik258 on Wed Mar 28, 2007 7:51 pm; edited 1 time in total |
|
Back to top |
|
 |
krinn Watchman


Joined: 02 May 2003 Posts: 7471
|
Posted: Sat Mar 24, 2007 7:35 pm Post subject: |
|
|
Code: |
cp /etc/init.d/net /etc/init.d/net.backup
echo 'config_eth0=( "192.168.1.1/24 ")' > /etc/init.d/net
echo 'routes_eth0=( "default via 192.168.1.0 ")' >> /etc/init.d/net
|
try to copy it as is don't miss ' or " |
|
Back to top |
|
 |
tuppe666 Guru


Joined: 02 Mar 2004 Posts: 423
|
Posted: Tue Mar 27, 2007 1:39 pm Post subject: |
|
|
Thank you for all your help I am up and running, and thats more than enough. I ploughed through all kinds of help files to get it working.
I did need ipkungfu 6.0 for everything to run smoothly though.
If anyone...can explain simply what I did originally, because all this currently seems to work like magic, and I hate that |
|
Back to top |
|
 |
erik258 Advocate


Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
Posted: Wed Mar 28, 2007 7:53 pm Post subject: |
|
|
The 'magic' is worked from /etc/init.d/net.* runscript(s). The commands you used manually are simply being run by init. _________________ Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit! |
|
Back to top |
|
 |
|