Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Want to replace ifconfig/route wit real startup files[solved
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
tuppe666
Guru
Guru


Joined: 02 Mar 2004
Posts: 423

PostPosted: Sat Mar 24, 2007 1:55 am    Post subject: Want to replace ifconfig/route wit real startup files[solved Reply with quote

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
View user's profile Send private message
didymos
Advocate
Advocate


Joined: 10 Oct 2005
Posts: 4798
Location: California

PostPosted: Sat Mar 24, 2007 5:27 am    Post subject: Reply with quote

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
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Sat Mar 24, 2007 5:28 am    Post subject: Reply with quote

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
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7471

PostPosted: Sat Mar 24, 2007 7:35 pm    Post subject: Reply with quote

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 :D don't miss ' or "
Back to top
View user's profile Send private message
tuppe666
Guru
Guru


Joined: 02 Mar 2004
Posts: 423

PostPosted: Tue Mar 27, 2007 1:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Wed Mar 28, 2007 7:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum