How to Modify IP in Ubuntu Server

sudo  ifconfig eth0 100.100.100.60 netmask 255.255.255.0

Note: 100.100.100.60 is the ip address you want to change (ie the destination address) followed by the subnet mask

 

Another way: modify the file /etc/network/interfaces

If you want to turn off the DHCP server (note: turn off your own dynamic routing configuration, not the server's DHCP to other clients), you only need to modify the file sudo vim /etc/network/interfaces

Add the following statement:

auto eth0

iface eth0inet static

addressxxx.xxx.xxx.xxx #IP address

netmaskxxx.xxx.xxx.xxx #Subnet mask

gatewayxxx.xxx.xxx.xxx #Gateway

--------------------------------------------------------------------------------------------------------------------------------------------

 UbuntuServer modify DNS

Open /etc/resolv.conf

sudo vim/etc/resolv.conf

Change it to the following:

searchlocaldomain #If this Server is a DNS server, you can add this sentence, if not, you can leave it out

nameserver172.16.3.4 #DNS you want to modify

nameserver172.16.3.3 #DNS you want to modify

 

----------------------------------------------------------------------------------------------------

UbuntuServer The last step, and the most important step

  Add this command to restart the network configuration in rc.local:

sudo/etc/init.d/networking restart

Note: If you are using a remote connection tool such as XShell, the above modification is unsuccessful except for the first one (that is, you can modify the ip at the top)

Guess you like

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