eduardo:linux:ip
This is an old revision of the document!
Table of Contents
IP Address
Temporary
- Use ifconfig command:
# ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
Permanent
- Find the configuration file corresponding to the NIC for which you want to set a static IP and edit it.
# cd /etc/sysconfig/networking/devices # vi ifcfg-eth0
- Now set the parameters below according to your settings
DEVICE=eth0 BOOTPROTO=none HWADDR=00:0C:29:DE:94:8B ONBOOT=yes TYPE=Ethernet USERCTL=no IPV6INIT=no PEERDNS=yes NETMASK=255.255.255.0 IPADDR=192.168.0.100 GATEWAY=192.168.0.1
- To set the nameservers, change directory to /etc and edit resolv.conf.
# cd /etc # vi resolv.conf
- The file format should be like this:
search your-dns-search-path nameserver dns1-ip-address nameserver dns2-ip-address nameserver dns3-ip-address
- Now save the configuration file and exit the text editor. To apply changes, we need to bring the network interface down and back up.
# ifdown eth0 # ifup eth0
eduardo/linux/ip.1300171343.txt.gz · Last modified: 2024/02/23 08:19 (external edit)