Nat third-party access the Internet through a dual-nic host [personal notes]

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.