5

In order to make the statically assigned IP work, I have already modified the file /etc/sysconfig/network-scripts/ifcfg-eth0 as follows:

DEVICE=eth0
IPADDR=10.33.17.143
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes

Any other configuration files that I might need to take care of before the static IP could be used? I am trying to change the network settings from the default DHCP to static IP.

2

You may also need to set a default route (often known as your default gateway) in /etc/sysconfig/network-scripts/route-eth0 as follows:

default via 1.2.3.4

Just make sure you substitute the correct Default Gateway for 1.2.3.4 otherwise Bad Things Will Happen... ;)

  • Thanks for your suggestion, but I can't find such a file as route-eth0 or alike in the directory. – Terry Li Jul 18 '11 at 20:11
  • 3
    You could add GATEWAY=x.x.x.x to ifcfg-eth0 to set a default gateway – katriel Jul 18 '11 at 20:34
  • I found from elsewhere that the DNS server also needs to be reconfigured, but haven't got an idea how to do it. – Terry Li Jul 19 '11 at 15:10
  • If the file doesn't exist, just create it. :) @katriel is correct that you can add the default gateway to ifcfg-eth0, however by putting it in the routes file you can add many more routes and view them all in one easy place. It also makes things easier to manage if you're using something such as puppet or chef. – Prof Falken Jul 20 '11 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.