Reply
Highlighted
New Member
Posts: 14
Registered: ‎05-15-2014
Kudos: 9
Accepted Solution

How to protect LAN1 <> LAN2

Hi,

 

I have an ER-X, which today I've upgraded to 1.10.5 and run a full reset + Basic wizard for 2 LAN. It is working well, but I cannot figure out how to put LAN2 into a "guest network" mode.

 

I'd like to make sure that:

- LAN2 cannot reach the NAS device on LAN1

- LAN2 cannot access the router's GUI

 

Is there anything else I need to do to make LAN2 a guest network?

Here is my full config (99% identical to a Basic Wizard):

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 drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    name WAN_LOCAL {
        default-action drop
        description "WAN to router"
        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 21 {
            action accept
            description "remote GUI"
            destination {
                port 33399
            }
            log disable
            protocol tcp
        }
    }
    receive-redirects disable
    send-redirects enable
    source-validation disable
    syn-cookies enable
}
interfaces {
    ethernet eth0 {
        address dhcp
        description Internet
        duplex auto
        firewall {
            in {
                name WAN_IN
            }
            local {
                name WAN_LOCAL
            }
        }
        speed auto
    }
    ethernet eth1 {
        address 192.168.0.1/24
        description "Local 2"
        duplex auto
        speed auto
    }
    ethernet eth2 {
        description Local
        duplex auto
        speed auto
    }
    ethernet eth3 {
        description Local
        duplex auto
        speed auto
    }
    ethernet eth4 {
        description Local
        duplex auto
        speed auto
    }
    loopback lo {
    }
    switch switch0 {
        address 192.168.1.1/24
        description Local
        mtu 1500
        switch-port {
            interface eth2 {
            }
            interface eth3 {
            }
            interface eth4 {
            }
            vlan-aware disable
        }
    }
}
port-forward {
    auto-firewall enable
    hairpin-nat enable
    lan-interface eth1
    rule 1 {
        description Synology
        forward-to {
            address 192.168.0.2
            port 5001
        }
        original-port 39876
        protocol tcp
    }
    wan-interface eth0
}
service {
    dhcp-server {
        disabled false
        hostfile-update disable
        shared-network-name LAN1 {
            authoritative enable
            subnet 192.168.0.0/24 {
                default-router 192.168.0.1
                dns-server 8.8.8.8
                dns-server 8.8.4.4
                lease 86400
                start 192.168.0.38 {
                    stop 192.168.0.243
                }
            }
        }
        shared-network-name LAN2 {
            authoritative enable
            subnet 192.168.1.0/24 {
                default-router 192.168.1.1
                dns-server 8.8.8.8
                dns-server 8.8.4.4
                lease 86400
                start 192.168.1.38 {
                    stop 192.168.1.243
                }
            }
        }
        static-arp disable
        use-dnsmasq disable
    }
    dns {
    }
    gui {
        http-port 80
        https-port 33399
        older-ciphers enable
    }
    nat {
        rule 5010 {
            description "masquerade for WAN"
            outbound-interface eth0
            type masquerade
        }
    }
    ubnt-discover {
        disable
    }
    unms {
        disable
    }
}
system {
    host-name ubnt
    login {
        user ubnt {
            authentication {
                encrypted-password ...
            }
            level admin
        }
    }
    ntp {
        server 0.ubnt.pool.ntp.org {
        }
        server 1.ubnt.pool.ntp.org {
        }
        server 2.ubnt.pool.ntp.org {
        }
        server 3.ubnt.pool.ntp.org {
        }
    }
    syslog {
        global {
            facility all {
                level notice
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone UTC
}

 

 


Accepted Solutions
SuperUser
Posts: 7,351
Registered: ‎01-05-2012
Kudos: 1936
Solutions: 959

Re: How to protect LAN1 <> LAN2

Did you read this ?

Cheers,

jonatha

View solution in original post


All Replies
SuperUser
Posts: 7,351
Registered: ‎01-05-2012
Kudos: 1936
Solutions: 959

Re: How to protect LAN1 <> LAN2

Did you read this ?

Cheers,

jonatha

New Member
Posts: 14
Registered: ‎05-15-2014
Kudos: 9

Re: How to protect LAN1 <> LAN2

No, I didn't know such good resource exists, at least it didn't the last time I've looked (2 years ago). 

 

If I use separeate LAN ports, can I just skip the groups part of the guide?

SuperUser
Posts: 7,351
Registered: ‎01-05-2012
Kudos: 1936
Solutions: 959

Re: How to protect LAN1 <> LAN2

If you wish, you can avoid to create the firewall group, and in the firewall rule declare only, as destination address, 192.168.0.0/24, in this way, the access to the whole 192.168.0.0/24 network is denied (not only the access to the NAS servers )
Cheers,
jonatha

New Member
Posts: 14
Registered: ‎05-15-2014
Kudos: 9

Re: How to protect LAN1 <> LAN2

[ Edited ]

Yes, it's ok to protect guests from each other as well. So do I understand right that something like this would do?

set firewall name PROTECT_IN 
set firewall name PROTECT_IN default-action accept 
set firewall name PROTECT_IN rule 20 action drop
set firewall name PROTECT_IN rule 20 description "Drop local"
set firewall name PROTECT_IN rule 20 destination ... 192.168.0.0/24
set firewall name PROTECT_IN rule 20 protocol all

set firewall name PROTECT_LOCAL 
set firewall name PROTECT_LOCAL default-action drop 
set firewall name PROTECT_LOCAL rule 20 action accept
set firewall name PROTECT_LOCAL rule 20 description "Accept DHCP"
set firewall name PROTECT_LOCAL rule 20 destination port 67
set firewall name PROTECT_LOCAL rule 20 protocol udp

set interfaces ethernet eth2 firewall in name PROTECT_IN
set interfaces ethernet eth2 firewall local name PROTECT_LOCAL

 

SuperUser
Posts: 7,351
Registered: ‎01-05-2012
Kudos: 1936
Solutions: 959

Re: How to protect LAN1 <> LAN2

[ Edited ]

More or less, yes

Spoiler
set firewall name PROTECT_IN rule 20 destination address 192.168.0.0/24

But I'd add, in the PROTECT_LOCAL, a rule for DNS, port 53, proto tcp_udp, action accept.

Not actually neededd, since you are using google's DNS.

Cheers,

jonatha

 

New Member
Posts: 14
Registered: ‎05-15-2014
Kudos: 9

Re: How to protect LAN1 <> LAN2

[ Edited ]

Thanks, I've added them (actually throught the GUI, but I think it was the same). I'm not using local DNS, just setting clients to use 8.8.8.8 via DHCP.

Does this config look reasonable now?

firewall {
    all-ping enable
    broadcast-ping disable
    ipv6-receive-redirects disable
    ipv6-src-route disable
    ip-src-route disable
    log-martians enable
    name GUEST_IN {
        default-action accept
        description ""
        rule 1 {
            action drop
            description "Drop Local"
            destination {
                address 192.168.0.0/24
            }
            log disable
            protocol all
        }
    }
    name GUEST_LOCAL {
        default-action drop
        description ""
        rule 1 {
            action accept
            description "Accept DHCP"
            destination {
                port 67
            }
            log disable
            protocol udp
        }
    }
    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 drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    name WAN_LOCAL {
        default-action drop
        description "WAN to router"
        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 21 {
            action accept
            description "remote GUI"
            destination {
                port 33399
            }
            log disable
            protocol tcp
        }
    }
    receive-redirects disable
    send-redirects enable
    source-validation disable
    syn-cookies enable
}
interfaces {
    ethernet eth0 {
        address dhcp
        description Internet
        duplex auto
        firewall {
            in {
                name WAN_IN
            }
            local {
                name WAN_LOCAL
            }
        }
        speed auto
    }
    ethernet eth1 {
        address 192.168.0.1/24
        description "Local 2"
        duplex auto
        speed auto
    }
    ethernet eth2 {
        description Local
        duplex auto
        firewall {
            in {
                name GUEST_IN
            }
            local {
                name GUEST_LOCAL
            }
        }
        speed auto
    }
    ethernet eth3 {
        description Local
        duplex auto
        speed auto
    }
    ethernet eth4 {
        description Local
        duplex auto
        speed auto
    }
    loopback lo {
    }
    switch switch0 {
        address 192.168.1.1/24
        description Local
        mtu 1500
        switch-port {
            interface eth2 {
            }
            interface eth3 {
            }
            interface eth4 {
            }
            vlan-aware disable
        }
    }
}
port-forward {
    auto-firewall enable
    hairpin-nat enable
    lan-interface eth1
    rule 1 {
        description Synology
        forward-to {
            address 192.168.0.2
            port 5001
        }
        original-port 39876
        protocol tcp
    }
    wan-interface eth0
}
service {
    dhcp-server {
        disabled false
        hostfile-update disable
        shared-network-name LAN1 {
            authoritative enable
            subnet 192.168.0.0/24 {
                default-router 192.168.0.1
                dns-server 8.8.8.8
                dns-server 8.8.4.4
                lease 86400
                start 192.168.0.38 {
                    stop 192.168.0.243
                }
            }
        }
        shared-network-name LAN2 {
            authoritative enable
            subnet 192.168.1.0/24 {
                default-router 192.168.1.1
                dns-server 8.8.8.8
                dns-server 8.8.4.4
                lease 86400
                start 192.168.1.38 {
                    stop 192.168.1.243
                }
            }
        }
        static-arp disable
        use-dnsmasq disable
    }
    dns {
    }
    gui {
        http-port 80
        https-port 33399
        older-ciphers enable
    }
    nat {
        rule 5010 {
            description "masquerade for WAN"
            outbound-interface eth0
            type masquerade
        }
    }
    ubnt-discover {
        disable
    }
    unms {
        disable
    }
}
system {
    host-name ubnt
    login {
        user ubnt {
            authentication {
                encrypted-password ...
            }
            level admin
        }
    }
    ntp {
        server 0.ubnt.pool.ntp.org {
        }
        server 1.ubnt.pool.ntp.org {
        }
        server 2.ubnt.pool.ntp.org {
        }
        server 3.ubnt.pool.ntp.org {
        }
    }
    syslog {
        global {
            facility all {
                level notice
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone UTC
}






New Member
Posts: 14
Registered: ‎05-15-2014
Kudos: 9

Re: How to protect LAN1 <> LAN2

Maybe I should add them to switch0 instead of eth2 though?
SuperUser
Posts: 7,351
Registered: ‎01-05-2012
Kudos: 1936
Solutions: 959

Re: How to protect LAN1 <> LAN2

Yes, firewall rulesets must be applied on L3 interfaces  (switch,  in this case)

New Member
Posts: 14
Registered: ‎05-15-2014
Kudos: 9

Re: How to protect LAN1 <> LAN2

Thanks a lot for all the help!

Reply