With the below commands you can configure the Static IP address in a Linux machine.
Configure IP address and Subnetmask:
#sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0
Configure Default Gateway/Router:
#sudo route add default gw 192.168.1.2
Configure DNS addresses:
Under Linux / UNIX / BSD operating system, you need to edit the /etc/resolv.conf file and add the line:
Configure IP address and Subnetmask:
#sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0
Configure Default Gateway/Router:
#sudo route add default gw 192.168.1.2
Configure DNS addresses:
Under Linux / UNIX / BSD operating system, you need to edit the /etc/resolv.conf file and add the line:
#vi /etc/resolv.conf
Modify or enter nameserver as follows:
nameserver 4.2.2.2
nameserver 4.2.2.1
(Note in your network you should use your ISP or your local DNS server addresses instead of 4.2.2.2 and 4.2.2.1)
No comments:
Post a Comment