Quantcast
Channel: All EdgeRouter posts
Viewing all articles
Browse latest Browse all 60861

Re: EdgeRouter Lite GRE Tunnel

$
0
0

For reference to other people trying to do the same the complete config (slightly redacted).. It now both does NAT to an internal server on eth1 and allows a dedicated server on eth2 with a direct extraip ip address.

 

 

firewall {
    all-ping enable
    broadcast-ping disable
    group {
        address-group extraip {
            address <extraip 2>
            address <extraip 3>
            address <extraip 4>
            address <extraip 5>
            address <extraip 6>
            address <extraip 7>
            description extraip
        }
    }
    ipv6-name WANv6_IN {
        default-action drop
        description "WAN IPv6 naar LAN"
        enable-default-log
        rule 10 {
            action accept
            description "Allow established/related"
            state {
                established enable
                related enable
            }
        }
        rule 20 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
        rule 30 {
            action accept
            description "Allow IPv6 icmp"
            icmpv6 {
                type echo-request
            }
            protocol ipv6-icmp
        }
    }
    ipv6-name WANv6_LOCAL {
        default-action drop
        description "WAN IPv6 naar Router"
        enable-default-log
        rule 10 {
            action accept
            description "Allow established/related"
            state {
                established enable
                related enable
            }
        }
        rule 20 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
        rule 30 {
            action accept
            description "Allow IPv6 icmp"
            protocol ipv6-icmp
        }
        rule 40 {
            action accept
            description "Allow dhcpv6"
            destination {
                port 546
            }
            protocol udp
            source {
                port 547
            }
        }
    }
    ipv6-receive-redirects disable
    ipv6-src-route disable
    ip-src-route disable
    log-martians enable
    modify PBR {
        enable-default-log
        rule 10
            // needed for return traffic to extraip
            action modify
            log disable
            modify {
                table 1
            }
            protocol tcp
            source {
                address <internal ip of webserver that listens on extraip>/32
                port 443
            }
        }
        rule 20 {
            // needed for return traffic to extraip
            action modify
            log disable
            modify {
                table 1
            }
            protocol tcp
            source {
                address <internal ip of webserver that listens on extraip>/32
                port 80
            }
        }
    }
    modify EXTRAIP {
        enable-default-log
        // needed for replies to external ip on eth2
       rule 30 {
            action modify
            log enable
            modify {
                table 1
            }
            source {
                address <extraip 2>/32
            }
        }
    }
    name WAN_IN {
        enable-default-log
        default-action drop
        description "WAN naar LAN"
        rule 10 {
            action accept
            description "Allow established/related"
            log disable
            state {
                established enable
                related enable
            }
        }
        rule 500 {
            action accept
            description "Allow vpn"
            destination {
                address <internal vpn server>/32
                port 1194
            }
            log disable
            protocol udp
        }
        rule 510 {
            action accept
            description "Allow ssh"
            destination {
                address <internal ssh server>/32
                port 22
            }
            log disable
            protocol tcp
        }
        rule 2000 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    name WAN_LOCAL {
        enable-default-log
        default-action drop
        description "WAN naar Router"
        rule 10 {
            action accept
            description "Allow established/related"
            log disable
            state {
                established enable
                invalid disable
                new disable
                related enable
            }
        }
        rule 20 {
            action drop
            description "Drop invalid state"
            state {
                established disable
                invalid enable
                new disable
                related disable
            }
        }
        rule 100 {
            action accept
            description "Allow GRE"
            log enable
            protocol gre
        }
    }
    receive-redirects disable
    send-redirects enable
    source-validation disable
    syn-cookies enable
}
interfaces {
    ethernet eth0 {
        description FTTH
        duplex auto
        mtu 1512
        speed auto
        vif 4 {
            address dhcp
            description "KPN IPTV"
            dhcp-options {
                client-option "send vendor-class-identifier &quot;IPTV_RG&quot;;"
                client-option "request subnet-mask, routers, rfc3442-classless-static-routes;"
                default-route no-update
                default-route-distance 210
                name-server update
            }
            mtu 1500
        }
        vif 6 {
            description "KPN Internet"
            mtu 1508
            pppoe 0 {
                default-route auto
                dhcpv6-pd {
                    no-dns
                    pd 0 {
                        interface eth1 {
                            host-address ::1
                            no-dns
                            prefix-id :1
                            service slaac
                        }
                        prefix-length /48
                    }
                    rapid-commit enable
                }
                firewall {
                    in {
                        ipv6-name WANv6_IN
                        name WAN_IN
                    }
                    local {
                        ipv6-name WANv6_LOCAL
                        name WAN_LOCAL
                    }
                }
                idle-timeout 180
                ipv6 {
                    address {
                        autoconf
                    }
                    dup-addr-detect-transmits 1
                    enable {
                    }
                }
                mtu 1500
                name-server auto
                password ppp
                user-id <mac>@internet
            }
        }
    }
    ethernet eth1 {
        address 192.168.2.254/24
        description Thuis
        duplex auto
        firewall {
            in {
                modify PBR
            }
        }
        speed auto
    }
    ethernet eth2 {
        address <extraip 1>/29
        description ExtraIP
        duplex auto
        firewall {
            in {
                modify EXTRAIP
            }
        }
        speed auto
    }
    loopback lo {
    }
    tunnel tun0 {
        // bogus address
        address 10.10.10.10/32
        description Extra-IP
        encapsulation gre
        local-ip <external ip of dsl connection
        multicast disable
        remote-ip <remote ip of gre tunnel>
        ttl 255
    }
}
protocols {
    igmp-proxy {
        interface eth0.4 {
            alt-subnet 0.0.0.0/0
            role upstream
            threshold 1
        }
        interface eth1 {
            alt-subnet 0.0.0.0/0
            role downstream
            threshold 1
        }
    }
    static {
        interface-route6 ::/0 {
            next-hop-interface pppoe0 {
            }
        }
        table 1 {
            interface-route 0.0.0.0/0 {
                next-hop-interface tun0 {
                }
            }
        }
    }
}
service {
    dhcp-server {
        disabled false
        global-parameters "option vendor-class-identifier code 60 = string;"
        global-parameters "option broadcast-address code 28 = ip-address;"
        hostfile-update disable
        shared-network-name Thuis {
            authoritative enable
            subnet 192.168.2.0/24 {
                dns-server 192.168.2.101
                lease 86400
                start 192.168.2.1 {
                    stop 192.168.2.200
                }
            }
        }
        static-arp disable
        use-dnsmasq enable
    }
    dns {
        forwarding {
            cache-size 4000
            listen-on eth1
            name-server <ns 1>
            name-server <ns 2>
            name-server <ns 3>
            name-server <ns 4>
            options listen-address=192.168.2.254
        }
    }
    gui {
        http-port 80
        https-port 443
        older-ciphers enable
    }
    nat {
        rule 120 {
            description "deliver https on extraip to haproxy"
            destination {
                group {
                    address-group extraip
                }
                port 443
            }
            inbound-interface tun0
            inside-address {
                address <internal address of webserver that should be NAT>
                port 443
            }
            log disable
            protocol tcp
            type destination
        }
        rule 130 {
            description "deliver http on extraip to haproxy"
            destination {
                group {
                    address-group extraip
                }
                port 80
            }
            inbound-interface tun0
            inside-address {
                address <internal address of webserver that should be NAT>
                port 80
            }
            log disable
            protocol tcp
            type destination
        }
        rule 140 {
            description "deliver ssh to ssh server"
            destination {
                address <external ip dsl>
                port 22
            }
            inbound-interface pppoe0
            inside-address {
                address <internal ip ssh server>
                port 22
            }
            log disable
            protocol tcp
            type destination
        }
        rule 310 {
            description vpn
            destination {
                address <external ip dsl>
                port 1194
            }
            inbound-interface pppoe0
            inside-address {
                address <internal ip vpn server>
                port 1194
            }
            log disable
            protocol udp
            type destination
        }
        rule 5000 {
            description IPTV
            destination {
                address 213.75.112.0/21
            }
            log disable
            outbound-interface eth0.4
            protocol all
            source {
                address 192.168.2.0/24
            }
            type masquerade
        }
        rule 5005 {
            description "source NAT extraIP"
            outside-address {
                address <extraip 1>
            }
            outbound-interface tun0
            source {
                address 10.10.10.10
            }
            log disable
            protocol all
            type source
        }
        rule 5010 {
            description Internet
            log disable
            outbound-interface pppoe0
            protocol all
            type masquerade
        }
    }
    ssh {
        port 22
        protocol-version v2
    }
    telnet {
        port 23
    }
    unms {
        connection <unms url>
    }
}
system {
    domain-name thuis.local
    host-name Thuis
    ipv6 {
        disable
    }
    login {
        user ubnt {
            authentication {
                encrypted-password <>
                plaintext-password ""
            }
            full-name Admin
            level admin
        }
    }
    name-server 127.0.0.1
    ntp {
        server 0.nl.pool.ntp.org {
        }
        server 1.nl.pool.ntp.org {
        }
        server ntp0.nl.net {
        }
        server ntp1.nl.net {
        }
        server time.kpn.net {
        }
    }
    offload {
        hwnat disable
        ipsec enable
        ipv4 {
            forwarding enable
            gre enable
            pppoe enable
            vlan enable
        }
        ipv6 {
            forwarding enable
            pppoe disable
            vlan enable
        }
    }
    syslog {
        global {
            facility all {
                level notice
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone Europe/Amsterdam
    traffic-analysis {
        dpi enable
        export enable
    }
}


/* Warning: Do not remove the following line. */
/* === vyatta-config-version: "config-management@1:conntrack@1:cron@1:dhcp-relay@1:dhcp-server@4:firewall@5:ipsec@5:nat@3:qos@1:quagga@2:suspend@1:system@4:ubnt-pptp@1:ubnt-udapi-server@1:ubnt-unms@1:ubnt-util@1:vrrp@1:webgui@1:webproxy@1:zone-policy@1" === */
/* Release version: v1.10.9.5166937.190213.1810 */

Viewing all articles
Browse latest Browse all 60861

Trending Articles