Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify ip address in linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to modify the ip address in linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

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 to execute the command, you can modify the ip address, subnet mask, gateway and other information.

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

What is the command to modify the ip address in linux

Log in to linux using the root user and open the entry terminal

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

After you enter, start editing and fill in the ip address, subnet mask, gateway, DNS, etc. Among them, "information in the red box" is necessary.

After editing, save and exit

Restart network services

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

Then the ping gateway and ping external network are tested. All ping means that the network is normal.

Detailed summary:

-modify ip address

Effective immediately:

# ifconfig eth0 192.168.1.155 netmask 255.255.255.0

Restart takes effect:

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

-modify default gateway

Effective immediately:

# route add default gw 192.168.1.1

Restart takes effect:

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

-modify dns

Modify vi / etc/resolv.conf

The modification takes effect immediately, and the restart is also effective.

-modify host name

Effective immediately:

# hostname test1

Restart takes effect:

Modify vi / etc/sysconfig/network

This is the end of the content of "how to modify the ip address in linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report