
Permanently add static IP and default gateway
July 2, 2006Red Hat Linux has made it fairly easy to set up network so that it will start automatically. There are a series of scripts in /etc/sysconfig/network-scripts that will do most of the work.
1. Binding IP address
In “/etc/sysconfig/network-scripts/ifcfg-eth0″, add your IPADDR (IP address), NETMASK, NETWORK and BROADCAST address
DEVICE=eth0 ONBOOT=yes IPADDR=192.168.0.x NETMASK=255.255.255.0 NETWORK=192.168.0.0 BROADCAST=192.168.0.255
2. Adding Default Gateway
In “/etc/sysconfig/network” add your default gateway.
GATEWAY=192.168.0.1
You can now restart your network:
#/etc/sysconfig/network-scripts/ifdown eth0 #/etc/sysconfig/network-scripts/ifup eth0
( please dont run the command remotely.. else you may have shutdown the interface and will be disconnected )
or in redhat:
#service network restart
or
# /etc/init.d/network restart
Check your “/sbin/route” (routing) to verify everything is in place and restarting your computer should hold your new settings.
Please add on your comments to not /etc/sysconfig/network-scripts/ifdown eth0 remotely. I was just following the tutorial, and realized the command by the time i pressed enter, and my connect went out! Great!
Lucky my server is in the other room.
Thanks for the help!
Thank you nick0 … corrected it.
very interesting. i’m adding in RSS Reader
jhgtiop ,
cheap soma, buy drug tramadol, lorazepam buy, buy valium, buy cheap fioricet, buy hoodia, norco online, generic ultram, buy ultracet, xenical,
or just use ifdown eth0 && ifup eth0
page turn union past
reducing article institute
For a remote restart, if using SSH, an option is to execute /etc/init.d/network restart. The SSH client will reconnected as soon it senses the server is back. At least this is what I usually do and works.
Nice post, for the
#/etc/sysconfig/network-scripts/ifdown eth0
#/etc/sysconfig/network-scripts/ifup eth0
section
I would replace with /etc/init.d/network restart as this works remotely