Linux network configuration

-------------------------------------------------Static IP------------------------------------------------- -------------

*, backup

cp /etc/network/interfaces /etc/network/interfaces_bak

 

*, modify the file content vim /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.0.111
gateway 192.168.0.1 #This address you need to confirm whether the gateway is this address
netmask 255.255.255.0

 

*, modify DNS

vim /etc/resolv.conf
Add to
nameserver 202.96.128.86 public network DNS can

 

*, restart the network card

/etc/init.d/network restart

 

-------------------------------------------------dynamic IP------------------------------------------------- -------------

*, backup

cp /etc/network/interfaces /etc/network/interfaces_bak

 

*, modify the file content vim /etc/network/interfaces

auto eth0
iface eth0 inet dhcp

 

*, restart the network card

/etc/init.d/network restart

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326428355&siteId=291194637