What is the command to change ip address in linux?

WBOY
Release: 2021-12-27 17:38:18
Original
54319 people have browsed it

The command to modify the IP address in Linux is "vi/etc/sysconfig/network-scripts/ifcfg-eth0"; use the root user to log in to Linux, open the terminal and execute this command, you can modify the IP address, subnet Netmask, gateway and other information.

What is the command to change ip address in linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the command to modify the IP address in Linux

Use the root user to log in to Linux and open the terminal

What is the command to change ip address in linux?

Enter in the terminal: vi /etc/sysconfig/network-scripts/ifcfg-eth0

What is the command to change ip address in linux?

##After pressing enter, start editing and fill in the ip Address, subnet mask, gateway, DNS, etc. Among them, the "information in the red box" is a must.

What is the command to change ip address in linux?

After editing is completed, save and exit

Restart network service

service network restart or /etc/init.d/network restart

Then ping the gateway and ping the external network for testing. If all can ping, it means the network is normal

What is the command to change ip address in linux?

Detailed summary:

---Modify the ip address---

Immediately effective:

# ifconfig eth0 192.168.1.155 netmask 255.255.255.0

Restart to take effect:

Modify vi /etc/sysconfig/network-scripts/ifcfg-eth0

---Modify default gateway---

Take effect immediately:

# route add default gw 192.168.1.1

Restart to take effect:

Modify vi / etc/sysconfig/network-scripts/ifcfg-eth0

---Modify dns---

Modify vi /etc/resolv.conf

The modification will take effect immediately. Restart is also valid

---Modify host name---

It takes effect immediately:

# hostname test1

Restart takes effect:

Modify vi /etc/sysconfig/network

Related recommendations: "

Linux Video Tutorial"

The above is the detailed content of What is the command to change ip address in linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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