Let Linux system do gateway, proxy Internet!!! __linux

Source: Internet
Author: User
Tags iptables

Server side:

Wireless network card: 192.168.1.101 can surf the internet

Wired network card: 192.168.9.12 can't surf the internet

Set up:

1. Turn on IP forwarding
echo "1" >/proc/sys/net/ipv4/ip_forward

2. Set Iptables rules
Iptables-t nat-a Postrouting-j Masquerade

Client: Wired network card: 192.168.9.101 to set the gateway: 192.168.9.12 will be able to access the Internet. (Originally the gateway is 192.168.9.1, not the Internet)


Server stops sharing Internet access method:

1, stop forwarding: echo "0" >/proc/sys/net/ipv4/ip_forward

2. Remove NAT rule: iptables-t nat-d postrouting 1



Reference:

http://www.gaojinbo.com/linux%E4%B8%8B%E4%BD%BF%E7%94%A8iptables%E5%81%9A%E8%B7%AF%E7%94%B1%E5%99%A8nat%E4%B8% 8a%e7%bd%91.html

http://blog.csdn.net/xyyangkun/article/details/9010309

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.