Why can't I use ssh for my snat script?

Source: Internet
Author: User
Why can't I use ssh for my snat script? -- Linux Enterprise Application-Linux server application information. For details, refer to the following section. 1. First create the file/etc/rc. d/snat-firewall, as shown below:
#! /Bin/bash
Echo "1">/proc/sys/net/ipv4/ip_forward
# Internet;
INET_IFACE = "eth0"
INET_IP = "***.***.***.***"
# LAN;
LAN_IFACE = "eth1"
LAN_IP = "10.1.1.8"
LAN_IP_RANGE = "10.1.1.0/8"
EPT = "/sbin/iptables"
/Sbin/depmod-
/Sbin/modprobe ip_tables
/Sbin/modprobe iptable_nat
/Sbin/modprobe ip_nat_ftp
/Sbin/modprobe ipt_LOG
$ Ipt-p INPUT ACCEPT
$ Ipt-p FORWARD ACCEPT
$ Ipt-p OUTPUT ACCEPT
$ Ipt-t nat-P PREROUTING ACCEPT
$ Ipt-t nat-P POSTROUTING ACCEPT
$ Ipt-t nat-P OUTPUT ACCEPT
For TABLE in filter nat mangle; do
$ Ipt-t $ TABLE-F
$ Ipt-t $ TABLE-X
Done
$ Ipt-a INPUT-m state -- state ESTABLISHED, RELATED-j ACCEPT
For DNS in $ (grep ^ n/etc/resolv. conf | awk '{print $2}'); do
$ Ipt-a INPUT-p udp-s $ DNS -- sport domain-j ACCEPT
Done
$ Ipt-n LOGDENY
$ Ipt-a LOGDENY-j LOG -- log-prefix "iptables :"
$ Ipt-a LOGDENY-j DROP
$ Ipt-a INPUT-I! Lo-m state -- state NEW, INVALID-j LOGDENY
If ["$ INET_IFACE" = ppp0]; then
$ Ipt-t nat-a postrouting-o $ INET_IFACE-j MASQUERADE
Else
$ Ipt-t nat-a postrouting-o $ INET_IFACE-j SNAT -- to $ INET_IP
Fi
$ Ipt-a INPUT-p tcp -- dport 22-j ACCEPT
$ Ipt-a OUTPUT-p udp -- dport 22-j ACCEPT

2. chmod u + x/etc/rc. d/snat-firewall

3. Execute the Script:/etc/rc. d/snat-firewall

The LAN can access the Internet, but it cannot access ssh. In this case, iptables is disabled and ssh is accessible. Where can I write an error? Is port 22 incorrect?
Thank you!

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.