Friday, November 22, 2013

Set a static internal IP

1. find a hooked interface

2. make a script in /etc/sysconfig/network-scripts
For example:
$cd /etc/sysconfig/network-scripts
$touch ifcfg-em1
$vim ifcfg-em1

DEVICE=em1
HWADDR=A4:BA:DB:1A:AC:4F this is the mac address of the interface
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.0.27 this is the static IP you want to set
BROADCAST=192.168.0.255
NETMASK=255.255.255.0

NAME=em1

3. restart the device
$ ifdown em1
$ ifup em1

4. finally, check if the static ip has been assigned to interface em1
$ ifconfig

No comments: