NAT configuration is successful in both systems.
Environment: the notebook is used as an intranet host, and the desktop and dual systems are started with Ubuntu
The desktop has an Ethernet card and a USB wireless network card. The configuration enables the ethernet card to connect to the Intranet and the Internet wirelessly.
1 ),
Notebook Configuration:
Disable Wired connection to the desktop (not to be able to help)
The local Nic configuration is as follows:
IP address 192.168.1.99 (random, but must be in the same network segment as Ubuntu's eth0)
Netmask 255.255.255.0
Gateway 192.168.1.88 (the eth0 IP address of ubuntu)
DNS 192.168.0.1 (not suitable? CAT/etc/resolv. conf contains nameserver 192.168.0.1)
2 ),
Desktop configuration:
Wired laptop and Wireless AP connection (if DHCP is obtained from the wireless address, no configuration is required)
Eth0 192.168.1.88 255.255.255.0
Wlan0 192.168.0.201 255.255.255.0
3 ),
Iptables-T Nat-A postrouting-s 192.168.1.0/24-O wlan0-J Masquerade
(-T specifies the table,-A postrouting rules after routing,-S source address,-O output interface, -J disguise the source address of the packet from 192.168.1.0/24 as the masquerade of wlan0)
4 ),
Remove # net. ipv4.ip _ forward = 1 line comment in/etc/sysctl. conf # (enable forwarding)
Over
Result:
In the Intranet, This Is The Notebook
Ping 192.168.1.88 (eth0 of ubuntu)
Ping 192.168.0.201 (wlan0 of ubuntu)
Ping www.baidu.com
Conclusion: eth0 is connected to the Intranet segment and wlan0 is connected to the Internet segment. The client gateway and DNS are not properly configured when the previous failures occurred!