Quantcast
Channel: EdgeRouter topics
Viewing all articles
Browse latest Browse all 20028

Help with NAT hairpin not working and mess with rules

$
0
0

Hi i just implemented an edgerouter erpro-8 with the following setup:

 

eth0: Lan 1 (192.168.1.0/24)
eth0.3: Vlan Co (192.168.3.0/24)
eth1: WAN (190.xx.xx.xx)
eth2.2: Vlan Co2 (192.168.2.x)
eth2.4: Vlan Co3 (192.168.4.x)

 

 

I configured NAT, firewall policies and Port forwarding so I can access from ouside an inside server. But when trying to access the same server from inside (through external IP) it just don't work. I checked the Hairpin NAT in the Port Forwarding tab and added the rules. Have rules in WAN_LOCAL and WAN_IN but none of them log the packets.  The NAT rules didn't log either as stays in the NAT Hairpin tutorial.

 

 

Configuration dump:

 

 

admin@r1:~$ cat /config/config.boot
firewall {
    all-ping enable
    broadcast-ping disable
    ipv6-receive-redirects disable
    ipv6-src-route disable
    ip-src-route disable
    log-martians enable
    name WAN_IN {
        default-action drop
        description "WAN to internal"
        rule 10 {
            action accept
            description "Allow established/related"
            state {
                established enable
                related enable
            }
        }
        rule 20 {
            action accept
            description "Allow Unifi Web 8443"
            destination {
                address 192.168.3.25
                port 8443
            }
            log enable
            protocol tcp
        }
        rule 30 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    name WAN_LOCAL {
        default-action drop
        description "WAN to router"
        enable-default-log
        rule 10 {
            action accept
            description "Allow established/related"
            state {
                established enable
                related enable
            }
        }
        rule 20 {
            action accept
            description "Allow PPTP Port 1723"
            destination {
                port 1723
            }
            log disable
            protocol tcp
        }
        rule 30 {
            action accept
            description "Allow PPTP GRE"
            log disable
            protocol gre
        }
        rule 40 {
            action accept
            description "Allow Unifi reporter 8080"
            destination {
                address 192.168.3.22
                port 8080
            }
            log enable
            protocol tcp
        }
        rule 50 {
            action accept
            description "Allow Unifi reporter 8443"
            destination {
                address 192.168.3.22
                port 8443
            }
            log enable
            protocol tcp
        }
        rule 60 {
            action accept
            description "Allow Web Nginx Proxy 80"
            destination {
                address 192.168.3.25
                port 80
            }
            log enable
            protocol tcp
        }
        rule 70 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    receive-redirects disable
    send-redirects enable
    source-validation disable
    syn-cookies enable
}
interfaces {
    ethernet eth0 {
        address 192.168.1.1/24
        description Local
        duplex auto
        speed auto
        vif 3 {
            address 192.168.3.1/24
            description "Co VLAN"
            mtu 1500
        }
    }
    ethernet eth1 {
        address 190.xxx.xxx.xxx/29
        description Internet
        duplex auto
        firewall {
            in {
                name WAN_IN
            }
            local {
                name WAN_LOCAL
            }
        }
        speed auto
    }
    ethernet eth2 {
        description "Local 2"
        duplex auto
        speed auto
        vif 2 {
            address 192.168.2.1/24
            description "VLAN Co2"
        }
        vif 4 {
            address 192.168.4.1/24
            description "VLAN Co3"
            mtu 1500
        }
    }
    ethernet eth3 {
        duplex auto
        speed auto
    }
    ethernet eth4 {
        duplex auto
        speed auto
    }
    ethernet eth5 {
        duplex auto
        speed auto
    }
    ethernet eth6 {
        duplex auto
        speed auto
    }
    ethernet eth7 {
        duplex auto
        speed auto
    }
    loopback lo {
    }
}
port-forward {
    auto-firewall enable
    hairpin-nat enable
    lan-interface eth0.3
    rule 1 {
        description "Unifi reporter"
        forward-to {
            address 192.168.3.22
            port 8080
        }
        original-port 8080
        protocol tcp_udp
    }
    rule 2 {
        description "Unifi Web"
        forward-to {
            address 192.168.3.22
            port 8443
        }
        original-port 8443
        protocol tcp_udp
    }
    rule 3 {
        description "nginx proxy"
        forward-to {
            address 192.168.3.25
            port 80
        }
        original-port 80
        protocol tcp_udp
    }
    wan-interface eth1
}
service {
    dhcp-server {
        disabled false
        hostfile-update disable
        shared-network-name Co2 {
            authoritative disable
            subnet 192.168.2.0/24 {
                default-router 192.168.2.1
                dns-server 192.168.3.26
                lease 86400
                start 192.168.2.21 {
                    stop 192.168.2.99
                }
            }
        }
        shared-network-name LAN1 {
            authoritative disable
            disable
            subnet 192.168.1.0/24 {
                default-router 192.168.1.1
                dns-server 192.168.1.1
                lease 86400
                start 192.168.1.21 {
                    stop 192.168.1.100
                }
            }
        }
        shared-network-name Co3 {
            authoritative disable
            subnet 192.168.4.0/24 {
                default-router 192.168.4.1
                dns-server 192.168.3.26
                lease 86400
                start 192.168.4.11 {
                    stop 192.168.4.99
                }
            }
        }
        use-dnsmasq disable
    }
    dns {
    }
    gui {
        http-port 80
        https-port 443
        listen-address 192.168.1.1
        older-ciphers enable
    }
    nat {
        rule 2 {
            description "Unifi reporter"
            destination {
                port 8080
            }
            inbound-interface eth0
            inside-address {
                address 192.168.3.22
            }
            log enable
            protocol tcp
            type destination
        }
        rule 4 {
            description "Unifi Web"
            destination {
                port 8443
            }
            inbound-interface eth0
            inside-address {
                address 192.168.3.22
            }
            log enable
            protocol tcp
            type destination
        }
        rule 5 {
            description "Nginx Web Proxy"
            destination {
                port 80
            }
            inbound-interface eth0
            inside-address {
                address 192.168.3.25
            }
            log enable
            protocol tcp
            type destination
        }
        rule 5010 {
            outbound-interface eth1
            type masquerade
        }
    }
    ssh {
        listen-address 192.168.1.1
        port 1295
        protocol-version v2
    }
}
system {
    gateway-address 190.xxx.xxx.xxx
    host-name r1
    login {
        user admin {
            authentication {
                encrypted-password ...
                plaintext-password ""
            }
            level admin
        }
    }
    name-server 8.8.8.8
    name-server 8.8.4.4
    ntp {
        server 0.ubnt.pool.ntp.org {
        }
        server 1.ubnt.pool.ntp.org {
        }
    }
    syslog {
        global {
            facility all {
                level notice
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone America/Santiago
    traffic-analysis {
        dpi enable
        export enable
    }
}
vpn {
    pptp {
        remote-access {
            authentication {
                local-users {
                    username john {
                        password ...
                    }
                }
                mode local
            }
            client-ip-pool {
                start 192.168.1.200
                stop 192.168.1.220
            }
            dns-servers {
                server-1 192.168.3.26
            }
            mtu 1492
            outside-address 190.xxx.xxx.xxx
        }
    }
}

 

 


Viewing all articles
Browse latest Browse all 20028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>