Configure the Linux kernel and use iptables for port ing (1)

Source: Internet
Author: User

ConfigurationLinux KernelAnd useIptablesPort CreationIngThe specific work is as follows:

Host IP Address: 192.168.1.100

Destination IP Address: 192.168.2.101

Requests to host 192.168.1.100: 11101 must be mapped to the sshd service port of the destination machine on the Intranet, that is, 192.168.2.101: 22.

Configure the Linux kernel (taking 2.6.18 as an example)

If the following information appears when you run iptable-L, you need to reconfigure and compile the kernel:

Iptables v1.4.2: can't initialize iptables table 'filter': Table does not exist (do you need to insmod ?)

Perhaps iptables or your kernel needs to be upgraded.

Configuration Options:

Networking -->

Networking options -->

[*] Network packet filtering (replaces ipchains)->

Core Netfilter Configuration->

<*> Netfilter Xtables support (required for ip_tables)

IP: Netfilter Configuration->

<*> Connection tracking (required for masq/NAT)

<*> IP tables support (required for filtering/masq/NAT)

<*> IP range match support

<*> Packet filtering

<*> REJECT target support

<*> Full NAT

The preceding configuration is only for port ing. If you need other functions, add relevant configurations as needed.

The steps for compiling and installing the kernel are skipped.

Iptabes

The iptables rules are as follows:

Iptables-t nat-a prerouting-p tcp-dport 11101-d 192.168.1.100-j DNAT-to-destination 192.168.2.101: 22


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.