>/etc/resolv.conf Restart the network service Copy the code as follows: servicenetworkrest"/> >/etc/resolv.conf Restart the network service Copy the code as follows: servicenetworkrest">

Home  >  Article  >  Operation and Maintenance  >  How to modify IP, gateway and DNS in Linux

How to modify IP, gateway and DNS in Linux

王林
王林forward
2023-05-12 20:55:102517browse

Network card eth0 IP is modified to 102.168.0.1

Copy code The code is as follows:

ifconfig eth0 102.168.0.1 netmask 255.255.255.0

The gateway is modified to 102.168 .0.254

Copy code The code is as follows:

route add default gw 102.168.0.254

linux command line to modify dns

Copy Code The code is as follows:

echo "nameserver 202.202.202.20 ">> /etc/resolv.conf

Restart the network service

Copy code The code is as follows:

service network restart

or

Copy code The code is as follows:

/etc/rc.d/init.d/network restrart

The above is the detailed content of How to modify IP, gateway and DNS in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete