瞻博网络 SRX-240。单地址转换

网络工程 纳特 杜松 杜松-srx 代理arp
2021-07-22 17:44:01

编辑 2 月 4 日该问题仍然相关,任何帮助表示赞赏。

在此处输入图片说明

再说一次,我不是网络工程师,所以这一定是一个菜鸟问题。

简单任务:我的专用网络中有一台服务器,我需要使其可从公共网络访问。

经过一番谷歌搜索后,我在瞻博网络站点上找到了本指南(为单一地址转换配置静态 NAT)。我按照指南说的做了,但仍然无法访问我的服务器(ping 失败)。

有人可以指出我的配置中的错误在哪里。

另外,我是否应该能够从 SRX CLI ping 到转换后的 ip (10.129.166.135)。我认为它应该有效,但现在没有。

命令:

set security nat destination pool DestinationNatVideo address 192.168.3.100/32
set security nat destination rule-set RuleSetVideo from interface ge-0/0/0.0
set security nat destination rule-set RuleSetVideo rule r1 match destination-address 10.129.166.135/32
set security nat destination rule-set RuleSetVideo rule r1 then destination-nat pool DestinationNatVideo
set security address-book global address VideoReceiver 192.168.3.100/32
set security policies from-zone wan to-zone trust policy server-access match source-address any
set security policies from-zone wan to-zone trust policy server-access match destination-address VideoReceiver
set security policies from-zone wan to-zone trust policy server-access match application any
set security policies from-zone wan to-zone trust policy server-access then permit

完整配置

version 11.2R4.3;
system {
    ports {
        console {
            log-out-on-disconnect;
            type vt100;
        }
    }
    name-server {
        10.128.1.22;
        10.128.1.23;
        8.8.8.8;
    }
    services {
        ssh {
            root-login allow;
        }
        telnet;
        xnm-clear-text;
        web-management {
            http {
                interface vlan.0;
            }
            https {
                system-generated-certificate;
                interface vlan.0;
            }
        }
        dhcp {
            pool 172.16.30.0/24 {
                address-range low 172.16.30.2 high 172.16.30.254;
                name-server {
                    10.128.1.22;
                    10.128.1.23;
                    8.8.8.8;
                }
                router {
                    172.16.30.1;
                }
            }
            pool 172.16.40.0/24 {
                address-range low 172.16.40.2 high 172.16.40.254;
                name-server {
                    10.128.1.22;
                    10.128.1.23;
                    8.8.8.8;
                }
                router {
                    172.16.40.1;
                }
            }
            pool 172.16.10.0/24 {
                address-range low 172.16.10.2 high 172.16.10.254;
                name-server {
                    10.128.1.22;
                    10.128.1.23;
                    8.8.8.8;
                }
                router {
                    172.16.10.1;
                }
            }
        }
    }
    syslog {
        archive size 100k files 3;
        user * {
            any emergency;
        }
        file messages {
            any critical;
            authorization info;
        }
        file interactive-commands {
            interactive-commands error;
        }
    }
    max-configurations-on-flash 5;
    max-configuration-rollbacks 5;
    license {
        autoupdate {
            url https://ae1.juniper.net/junos/key_retrieval;
        }
    }
}
interfaces {
    ge-0/0/0 {
        speed 100m;
        link-mode full-duplex;
        unit 0 {
            family ethernet-switching {
                vlan {
                    members wan;
                }
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family ethernet-switching {
                port-mode trunk;
                vlan {
                    members [ vlan-trust all ];
                }
                native-vlan-id 1;
            }
        }
    }
    ge-0/0/2 {
        unit 0 {
            family ethernet-switching {
                port-mode trunk;
                vlan {
                    members [ vlan-trust all ];
                }
            }
        }
    }
    ge-0/0/3 {
        unit 0 {
            family ethernet-switching {
                port-mode trunk;
                vlan {
                    members [ vlan-trust all ];
                }
                native-vlan-id 10;
            }
        }
    }
    ge-0/0/4 {
        unit 0 {
            family ethernet-switching {
                port-mode trunk;
                vlan {
                    members [ vlan-trust all ];
                }
                native-vlan-id 10;
            }
        }
    }
    ge-0/0/5 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/6 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/7 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/8 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/9 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/10 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/11 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/12 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/13 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/14 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    ge-0/0/15 {
        unit 0 {
            family ethernet-switching {
                vlan {
                    members vlan-trust;
                }
            }
        }
    }
    vlan {
        unit 0 {
            family inet;
        }
        unit 10 {
            family inet {
                address 172.16.10.1/24;
            }
        }
        unit 20 {
            family inet {
                address 172.16.20.1/24;
            }
        }
        unit 30 {
            family inet {
                address 172.16.30.1/24;
            }
        }
        unit 40 {
            family inet {
                address 172.16.40.1/24;
            }
        }
        unit 50 {
            family inet {
                address 172.16.50.1/24;
            }
        }
        unit 60 {
            family inet {
                address 192.168.3.1/24;
            }
        }
        unit 100 {
            family inet {
                address 10.129.166.132/25;
            }
        }
    }
}
snmp {
    client-list ss;
    community school-ro {
        authorization read-only;
        clients {
            10.143.255.2/32;
            10.143.255.6/32;
            10.143.255.10/32;
            10.143.255.14/32;
            10.143.255.42/32;
            10.136.7.5/32;
        }
    }
    trap-options;
    trap-group ESMA {
        categories {
            authentication;
            chassis;
            remote-operations;
            routing;
            startup;
            rmon-alarm;
            vrrp-events;
            configuration;
            services;
            chassis-cluster;
        }
        targets {
            10.143.255.2;
            10.143.255.6;
            10.143.255.10;
            10.143.255.14;
            10.143.255.42;
            10.136.7.5;
        }
    }
}
routing-options {
    static {
        route 0.0.0.0/0 next-hop 10.129.166.129;
    }
}
protocols {
    stp;
}
security {
    address-book {
        global {
            address VideoReceiver 192.168.3.100/32;
        }
    }
    screen {
        ids-option untrust-screen {
            icmp {
                ping-death;
            }
            ip {
                source-route-option;
                tear-drop;
            }
            tcp {
                syn-flood {
                    alarm-threshold 1024;
                    attack-threshold 200;
                    source-threshold 1024;
                    destination-threshold 2048;
                    timeout 20;
                }
                land;
            }
        }
    }
    nat {
        source {
            rule-set trust-to-wan {
                from zone trust;
                to zone wan;
                rule source-nat-rule {
                    match {
                        source-address 0.0.0.0/0;
                    }
                    then {
                        source-nat {
                            interface;
                        }
                    }
                }
            }
        }
        destination {
            pool DestinationNatVideo {
                address 192.168.3.100/32;
            }
            rule-set RuleSetVideo {
                from interface ge-0/0/0.0;
                rule r1 {
                    match {
                        destination-address 10.129.166.135/32;
                    }
                    then {
                        destination-nat pool DestinationNatVideo;
                    }
                }
            }
        }
        proxy-arp {
            interface ge-0/0/0.0 {
                address {
                    10.129.166.135/32;
                }
            }
        }
    }
    policies {
        from-zone trust to-zone untrust {
            policy trust-to-untrust {
                match {
                    source-address any;
                    destination-address any;
                    application any;
                }
                then {
                    permit;
                }
            }
        }
        from-zone trust to-zone wan {
            policy internet {
                match {
                    source-address any;
                    destination-address any;
                    application any;
                }
                then {
                    permit;
                }
            }
        }
        from-zone wan to-zone trust {
            policy server-access {
                match {
                    source-address any;
                    destination-address VideoReceiver;
                    application any;
                }
                then {
                    permit;
                }
            }
        }
    }
    zones {
        security-zone trust {
            host-inbound-traffic {
                system-services {
                    all;
                }
                protocols {
                    all;
                }
            }
            interfaces {
                vlan.0;
                vlan.10;
                vlan.30;
                vlan.40;
                vlan.60;
            }
        }
        security-zone untrust {
            screen untrust-screen;
        }
        security-zone wan {
            host-inbound-traffic {
                system-services {
                    all;
                }
                protocols {
                    all;
                }
            }
            interfaces {
                vlan.100;
            }
        }
    }
}
vlans {
    management {
        vlan-id 10;
        l3-interface vlan.10;
    }
    private-eth {
        vlan-id 20;
        l3-interface vlan.20;
    }
    private-wifi {
        vlan-id 40;
        l3-interface vlan.40;
    }
    public-eth {
        vlan-id 30;
        l3-interface vlan.30;
    }
    public-wifi {
        vlan-id 50;
        l3-interface vlan.50;
    }
    vlan-trust {
        vlan-id 3;
        l3-interface vlan.60;
    }
    wan {
        vlan-id 100;
        l3-interface vlan.100;
    }
}
1个回答

您是否需要服务器也访问公网或仅回复来自公网的请求?在第一种情况下,您使用静态 nat(双向 NAT),在第二种情况下,您使用目标 nat。

关于您的 ping 测试,您尝试 ping 一个 IP,由于 proxy-arp 配置,该 IP 配置为仅从 ge-0/0/0 接口响应。也许您可以尝试像这样 ping 它:ping 10.129.166.135 source 10.129.166.132,但我建议将“natted”IP 重新配置到服务器,因为这样更容易排除故障。

我还注意到 vlan.60 接口未在信任区域中配置,因此除了其他问题之外,所有进出 vlan.60 子网的流量都将被阻止,并且不会应用 nat 配置。

作为旁注,我不知道您连接到什么类型的公共网络,但是wan安全区域上的主机入站流量配置应该减少到绝对最小值,或者如果可能,删除,因为这仅控制到防火墙本身的流量(例如,允许 ssh 连接或从公共网络 ping 防火墙)。


目标 nat + 端口转发的建议解决方案

此示例/解决方案将使用 wan 接口的地址并将端口 (5000) 映射到内部地址的端口 22 (ssh):

set security nat destination pool DestinationNatVideo address 192.168.3.100/32
set security nat destination pool DestinationNatVideo address port 22
set security nat destination rule-set RuleSetVideo from zone wan
set security nat destination rule-set RuleSetVideo rule r1 match destination-address 10.129.166.132/32
set security nat destination rule-set RuleSetVideo rule r1 match destination-port 5000
set security nat destination rule-set RuleSetVideo rule r1 then destination-nat pool DestinationNatVideo

您也可以删除它set security nat destination pool DestinationNatVideo address port 22,它应该将端口 5000 映射到内部 IP 的所有服务(最好为每个服务映射一个端口,而不是让所有内容都打开/可连接)。

您设备中安装的版本有点旧,也许它不太支持 nat(或只是其中的一部分),所以 YMMV。