In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "CentOS 7.x NAT mode Internet configuration method". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
The local environment is described as follows:
VM version--vmware workstation pro 12.x
System image--centos-7-x86_64-dvd-1511.iso
static ip address--10.0.0.102
netmask--10.0.0.2
vmware configuration
On the Edit tab, select Virtual Network Editor
Select vmnet8 and modify the subnet ip and subnet mask. Be careful not to check the option "Assign ip addresses to virtual machines using local dhcp service":
Click nat settings and edit the following:
After setting, apply the modified settings
II Configuration Network Card Configuration File
Log in to centos7- x86_64 system and edit network card configuration file.
Note: The default NIC file for centos7.x is ifcfg-eno 1677736. Users can choose to add the following information before installing the system:
net.ifnames=0 net.biosdevname=0
After adding the information, press Enter directly to start installing the operating system.
Original profile information:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0type=ethernetbootproto=dhcpdefroute=yespeerdns=yespeerroutes=yesipv4_failure_fatal=no#ipv6init=yes#ipv6_autoconf=yes#ipv6_defroute=yes#ipv6_peerdns=yes#ipv6_peerroutes=yes#ipv6_failure_fatal=noname=eth0uuid=db47cec1-8f63-470f-a7ce-78dc1abf9a50device=eth0onboot=no"/etc/sysconfig/network-scripts/ifcfg-eth0"
To implement nat, you need to modify the following information:
bootproto=static #Original value "dhcp", changed to "static"ipaddr=10.0.0.102 #Add static ip address netmask= 255.255.0 #Add subnet mask gateway=10.0.0.2 #Add gateway, According to the subnet configuration in vmware software 'Virtual Network Editor', dns1=10.0.0.2 #Add preferred dns server dns2= 223.5.5 #Add standby dns server onboot=yes #Original value "no", changed to "yes", meaning that network card eth0 starts with boot
The modified network card configuration file information:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 type=ethernetbootproto=staticipaddr=10.0.0.102netmask=255.255.255.0gateway=10.0.0.2dns1=10.0.0.2dns2=223.5.5.5defroute=yespeerdns=yespeerroutes=yesipv4_failure_fatal=no#ipv6init=yes#ipv6_autoconf=yes#ipv6_defroute=yes#ipv6_peerdns=yes#ipv6_peerroutes=yes#ipv6_failure_fatal=noname=eth0uuid=db47cec1-8f63-470f-a7ce-78dc1abf9a50device=eth0onboot=yes"/etc/sysconfig/network-scripts/ifcfg-eth0"
After modification, restart network service:
/etc/init.d/network restart
Test connectivity:
\# ping www.baidu.comping www.baidu.com (119.75.218.70) 56(84) bytes of data.64 bytes from 119.75.218.70: icmp_seq=1 ttl=128 time=82.5 ms64 bytes from 119.75.218.70: icmp_seq=2 ttl=128 time=5.04 ms64 bytes from 119.75.218.70: icmp_seq=3 ttl=128 time=84.7 ms64 bytes from 119.75.218.70: icmp_seq=4 ttl=128 time=74.8 ms64 bytes from 119.75.218.70: icmp_seq=5 ttl=128 time=24.9 ms64 bytes from 119.75.218.70: icmp_seq=6 ttl=128 time=72.5 ms^c64 bytes from 119.75.218.70: icmp_seq=7 ttl=128 time=95.4 ms--- www.baidu.com ping statistics ---7 packets transmitted, 7 received, 0% packet loss, time 9939msrtt min/avg/max/mdev = 5.043/62.879/95.452/31.495 ms#
Three nat mode Internet configuration completed
After pinging the network, you can download the required software applications.
1. It is recommended to install epel repository and install common commands
# rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm # yum install -y net-tools vim lrzsz tree screen lsof tcpdump
2. Close network manager and firewall
# systemctl disable firewalld # systemctl disable networkmanager
3. Close and confirm selinux is closed
# vim /etc/sysconfig/selinux selinux=disabled #modified to disabled
Update the system and restart
# yum update -y && reboot
Four vmware fusion nat Internet settings
Edit files using iterms
The requirement is to access the Internet through the network number set by the virtual machine, so modify the netmask and subnet of vmnet8; the modified file content is as follows:
version=1,0 answer vnet_1_dhcp yes answer vnet_1_dhcp_cfg_hash 7c0a6ba01faeb4aa67d79a3b663ed0cd669ebe5b answer vnet_1_hostonly_netmask 255.255.255.0 answer vnet_1_hostonly_subnet 192.168.211.0 answer vnet_1_virtual_adapter yes answer vnet_8_dhcp yes answer vnet_8_dhcp_cfg_hash 0849581b4878eb20736f9d4ff8dcb8d65d6b17ae answer vnet_8_hostonly_netmask 255.255.255.0 answer vnet_8_hostonly_subnet 192.168.56.0 answer vnet_8_nat yes answer vnet_8_virtual_adapter yes add_bridge_mapping en1 2 ~ ~ ~ ~ ~ ~ ~ ~ "/library/preferences/vmware fusion/networking" [readonly] 13l, 488c
2. Set the network card information of the virtual machine
Modify the file content, the same as the second part of this article modified network card configuration. Copy and paste is not available here.
Note: When modifying the NIC configuration file here, take a look at the nat.conf configuration file in the mac path, which has the gateway address of the IP segment after modification! I just crawled out of this hole.
3. Other basic settings
As with the second part of this article, you can set it up.
"CentOS 7.x NAT mode Internet configuration method" content introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.