In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to automatically obtain and statically configure IP under Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to automatically obtain and statically configure IP under Linux".
Step 1: activate the network card
After the system is installed, the default network card is eth0, use the following command to activate this network card.
The code is as follows:
# ifconfig eth0 up
Step 2: set up the network card to start when entering the system.
If you want to automatically get an IP address to surf the Internet every time you boot, you need to set up the network service to start when the system starts. Linux is different from windows in that many services are stopped by default, and if you start the service when you use the service, but do not set it to start by default, the service will still stop the next time you enter the system. Here is how to set up the network service to start when the system starts.
Use the chkconfig command to have the network service start by default when the system startup level is 2345.
The code is as follows:
# chkconfig-- level 2345 network on
Step 3: modify the network card file ifcfg-eth0
Modify the ifcfg-eth0 file and set the value of ONBOOT to yes so that the network card is used when the network service is started. Set the value of BOOTPROTO to dhcp to allow the network card to automatically obtain the IP address from the DHCP server.
The code is as follows:
# vi / etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
BOOTPROTO=dhcp
Summary:
In general, the third step is the most important, because most Linux systems default to the network service is also started when the system starts, the network card is also enabled, as long as the third step is set, and then use the following command to start the network service on OK.
The code is as follows:
# service network start
Configure a static IP address to access the Internet in the same way as a dynamic IP address, modify the ifcfg-eth0, and then restart the network service with a command service network retart.
The code is as follows:
DEVICE=eth0
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS=8.8.8.8
BOOTPROTO=static
ONBOOT=yes
Thank you for your reading, the above is the content of "how to automatically obtain and statically configure IP under Linux". After the study of this article, I believe you have a deeper understanding of how to automatically obtain and statically configure IP under Linux. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.