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 by command line in Linux system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today I will show you how the Linux system modifies IP through the command line. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.

It's easy to change IP in the graphical interface of the Linux system, but do you know how to change IP from the command line?

Linux change ip address command

It's easy to change the IP address using the graphical interface, but did you know that Linux also allows you to change the IP address of the network card using simple commands on the command line?

This technique should be available in all DebianLinux-based distributions, including Ubuntu. First, type ifconfig at the terminal prompt, and then press Enter. This command lists all network interfaces on the system, so make a note of the name of the interface whose IP address you want to change.

To change the settings, you can also use the ifconfig command, this time with some additional parameters. The following command changes the network interface named "eth0" to use the IP address 102.168.0.1 and assigns a subnet mask of 255.255.255.0:

Sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0

Of course, you can replace it with any value you want. If you run ifconfig again, you will see that the interface has now adopted the new settings assigned to it.

If you also need to change the default gateway used by the network interface, you can use the route command. For example, the following command sets the default gateway for the "eth0" interface to 192.168.0.253:

Sudo route add default gw 192.168.0.253 eth0

To see the new settings, you need to display the routing table. Type the following command at the prompt, and then press Enter:

Route-n

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

This is how the Linux system modifies all the contents of IP through the command line. For more information about how the Linux system modifies IP through the command line, you can search the previous articles or browse the following articles to learn! I believe the editor will add more knowledge to you. I hope you can support it!

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

Development

Wechat

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

12
Report