RHEL / Red hat / Fedora / CentOS Linux Static IP Configuration
For static IP config you need to edit the following files using a text editor such as vi. I have a post with some simple vi commands to help you achieve this.
#cd /etc/sysconfig/
Sample of my config
# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=cucm.pub
GATEWAY=192.168.1.1
Edit /etc/sysconfig/network-scripts/ifcfg-eth1
Sample of my config
DEVICE=eth1
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:**:**:**:**:**
IPADDR=192.168.1.50
NETMASK=255.255.255.0
ONBOOT=yes
Then make sure you have your DNS services in /etc/resolv.conf
# cat /etc/resolv.conf
Sample of my config
search home.local
nameserver 8.8.4.4
nameserver 8.8.8.8
Now restart the service like this
# /etc/init.d/network restart
and finally test like this:
# ifconfig eth1
# route -n
# ping 192.168.1.1
# ping google.com
Unbuntu \ Debian
open with gedit or any other editor you feel comfortable with /etc/network/interfaces
sudo gedit /etc/network/interfaceIf you are using DHCP, you will see the following lines
auto eth0
iface eth0 inet dhcp
Now change the settings as below
auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Restart the neworking service using the following command
sudo /etc/init.d/networking restart
or service /networking restart
No comments:
Post a Comment