Click to See Complete Forum and Search --> : Help on Redhat and Networking
ztopher
04-09-2003, 06:03 PM
Hi
I have a redhat box at home acting as a server. I had to add the following to my rc.local script to make it connect to the Internet at startup.
# Remove default route. If this is not done adsl-start will not set ppp0 to the default route. (1)
route del default gw 198.162.0.1
# start rp-pppoe (2)
adsl-start
#call my firewall script(3)
/etc/rc.d/rc.firewall
I have tried to find out in which file the default gw is set to 192.168.0.1 (1) above without any luck. Is there any way to configure redhat 7.1 (no X) so no default gw route is set at startup, if there is please let me know ? I have read somewhere that this could be done via Network Configuration Module by disable the options Default Gateway and Default gateway device. But since I don’t have X on my server I need to know how to make these settings without a GUI, If my information is correct that is. Hope someone can help me out!!!
Thanks
Ztopher
BTW
Has /etc/sysconfig/network something to do with this?
EnigmaOne
04-09-2003, 06:31 PM
check the contents of:
/etc/sysconfig/network
ztopher
04-09-2003, 06:35 PM
My /etc/sysconfig/network looks like this:
NETWORKING=yes
HOSTNAME=localhost.localdomain
FORWARD_IPV4=true
GATEWAYDEV=
GATEWAY=
Is this correct :confused:
paul.shelb
04-09-2003, 10:58 PM
Try changing it to:
NETWORKING=yes
HOSTNAME=localhost.localdomain
FORWARD_IPV4=true
GATEWAYDEV= <eth n>
GATEWAY=192.168.0.1
Hope this helps..
Also, you shouldn't have to run adsl-start via rc.local. You should be able to do it as part of the run level startup (3, 5 what ever).
Magueta
04-09-2003, 11:14 PM
Also, iptables and ipchains look for a file in /etc/sysconfig called iptables or ipchains so you don't have to do it through the rc file. Once your rules are created the way you want them you can use iptables-save > /etc/sysconfig/iptables to generate a file that'll reset your rules every time you boot. Also, if you want to reset them without restarting your server you can just go to the /etc/init.d directory and type ./iptables restart. It seems a little easier than having to maintain an rc.local file.
Joe
ztopher
04-10-2003, 02:45 AM
Thank you but
...paul.shelb suggested that I should change my etc/sysconfig/network to....
NETWORKING=yes
HOSTNAME=localhost.localdomain
FORWARD_IPV4=true
GATEWAYDEV= <eth n>
GATEWAY=192.168.0.1
Is not that a way of setting the default route to eth0, or what ever interface you specify, and the gateway 192.168.0.1. This is done on my system without these entries and I don't know why and I do not want any gw by default...actually this was my question ;-) I have tried to set GATEWAYDEV to ppp0 but this is obviously wrong since my ppp0 interface is not up when my /etc/sysconfig/ network is read.
Cheers
Magueta
04-10-2003, 10:20 AM
Are you using DHCP? DHCP will do it all for you. Check the file ifcfg-eth0 for your ethernet and I believe there's one called ifcfg-ppp for dialup. These files are located in /etc/sysconfig/network-scripts.
Just curious, why do you want to have no configured gateway when you boot your system?
Joe
ztopher
04-10-2003, 02:54 PM
I have figured it out, with a little help from you guys ;-)
I think the reason why my default gateway always got set to 192.168.0.1, even if my /etc/sysconfig/network files says differently was because my ADSL modem has a built in dhcp server and since my eth0 was set to dhcp it all got messed up. I think this has something to do with RIP but I am not sure. Anyway now I have changed my ifcfg-eth0 file so it sets static IP to eth0. So when I start my adsl link, everything works and my default gw is set to ppp0 ;-) I actually start my adsl connection as a service now and it feels great.
And to answer your question, Joe. My Linux box is a router, a File server and a WEB server...and I am tying to learn more about Linux and I guess that is the main reason way I would like to have everything starting up when I boot up my server. To learn more about Linux.
Now I only have to figure out how to start my firewall as a service. Haven’t got it to work yet but I hope I will soon. I have followed Joes instructions but I have to run my rc.firewall script anyway…