domingo, 31 de julio de 2011

Permanently add static IP and default gateway

Red 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.

No hay comentarios:

Publicar un comentario