In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to configure static IP under Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The configuration file for network configuration is under / etc/sysconfig/network-scripts/. The file name is prefixed with ifcfg- followed by the name of the network card, which can be viewed and edited by double TAB keys, or you can view it using ifconfig, or you can use the command:
Ls / etc/sysconfig/network-scripts/ifcfg-*-lists all device profiles
Ifcfg-lo is the configuration file for the local loopback address. All computers have it. Don't touch it. We just need to modify the ifcfg-eth0.
Vim / etc/sysconfig/network-scripts/ifcfg-eth0
Open the configuration file for editing. By default, the configuration file is acquired dynamically by dhcp, as shown below:
If you want to change it to static, first change BOOTPROTO= "dhcp" to BOOTPROTO= "static" to indicate static acquisition, and then add something like the following configuration at the end:
BROADCAST=192.168.1.255-LAN broadcast address (not set here) IPADDR=192.168.1.33-static IPNETMASK=255.255.255.0-subnet mask GATEWAY=192.168.1.1-gateway or routing address
Save exit after configuration is complete
Set it all up, then use the command:
/ etc/init.d/network restart or service network restart
Restart the network service. After restart, if the route is configured to support static IP, then linux can get the IP address just configured, so the static IP is configured successfully!
It should be noted that because I am using a virtual machine, the environment cloned directly in VMware, all but the first virtual machine, the last several have exceptions in the final execution of service network restart
[root@localhost Desktop] # service network restart Shutting down loopback interface: [OK] Bringing up loopback interface: [OK] Bringing up interface eth0: Error: No suitable device found: no device found for connection 'System eth0'. [FAILED]
# ifconfig eth3 Link encap:Ethernet HWaddr 00:0C:29:BA:B1:78
Solution:
Run ifconfig first
Replace the HWaddr 00:0C:29:0E:9F:80 found by ifconfig with the HWADDR in / etc/sysconfig/network-scripts/ifcfg-eth0.
Then change ifcfg-eth0 to ifcfg-eth2, corresponding to eth2 in ifconfig
Cp ifcfg-eth0 ifcfg-eth2rm-rf ifcfg-eth0
Then run service network restart.
This is the end of this article on "how to configure static IP under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.