In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Set IP address under CentOS/Linux
1. Temporary modification:
1. Modify the IP address
Ifconfig eth0 192.168.100.100
2. Modify the gateway address
Route add default gw 192.168.100.1 dev eth0
3. Modify DNS
Echo "nameserver 8.8.8.8" > > / etc/resolv.conf
At this time, you can surf the Internet with the IP address of 192.168.100.100 and the gateway address of 192.168.100.1. However, this setting is temporary. Once the Nic is restarted or the server is restarted, everything will be restored except for modifying the DNS operation. This method is only suitable for temporary IP modification. If you want to permanently modify the network card configuration file, you need to modify the corresponding file.
Free video tutorials sharing: linux video tutorials
II. Permanent modification
1. Modify the IP address
Modify the / etc/sysconfig/network-scripts/ifcfg-eth0 file, and if there are multiple network cards, modify the corresponding network card
The device alias corresponding to the vi / etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0 # Nic: how the ip address is obtained by the BOOTPROTO=static # Nic (default is dhcp, which means automatic acquisition) HWADDR=00:07:E9:05:E8:B4 # Nic MAC address (physical address) IPADDR=192.168.100.100 # IP address NETMASK=255.255.255.0 # Subnet Mask ONBOOT=yes # whether to activate this device when the system boots
2. Modify the gateway address
Modify / etc/sysconfig/network file
Vi / etc/sysconfig/networkNETWORKING=yes # indicates whether the system uses the network, while no indicates that the host name of the local machine cannot be set using network HOSTNAME=doiido #. It should be the same as the host name set in / etc/hosts. GATEWAY=192.168.100.1 # sets the IP address of the gateway.
At this time, it is possible to ping the IP address, but it is not possible to ping the domain name, so you need to modify DNS.
3. Modify DNS
Modify / etc/resolv.conf file
Vi / etc/resolv.confnameserver 8.8.8.8 # google Domain name Server nameserver 114.144.114.114 # domestic Domain name Server
4. Restart the network card
Service network restart is shutting down interface eth0: [OK] closing loopback interface: [OK] pop-up loopback interface: [OK] pop-up interface eth0: [OK]
At this time, the system can surf the Internet normally.
These are the details of how to configure ip in linux, please pay attention to other related articles!
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.