Linux shared Internet Settings

Source: Internet
Author: User

1. Turn on the kernel IP forwarding vi/etc/sysctl.conf

Net.ipv4.ip_forward = 1

Execution Sysctrl-p Effective

2, if the host is not enabled firewall, then the following settings iptables

[[email protected] ~] # iptables -f [[email protected] ~] # iptables -p input accept [[email protected] ~] # IPTABLES -P FORWARD ACCEPT  [[email protected] ~] # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE Or
iptables -t nat -A POSTROUTING -s ip -o eth0 -j MASQUERADE
[[email protected] ~] # /etc/init.d/iptables save [[email protected] ~] # /etc/init.d/iptables restart description:    IPTABLES -F  #清除原有的filter有中的规则      IPTABLES -T NAT -F  #清除原有的nat表中的规则    IPTABLES -P FORWARD ACCEPT  #缺省允许IP转发

If a firewall is enabled on the host, add the following two sentences:

Code:

Iptables-a forward-s 192.168.122.0/24-o eth0-j ACCEPT
Iptables-a forward-d 192.168.122.0/24-m State--state established,related-i eth0-j ACCEPT

Linux shared Internet Settings

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.