How to modify IP, gateway and DNS in Linux

王林
Release: 2023-05-12 20:55:10
forward
2492 people have browsed it

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!