Can I simplify my double nat network with vlan?

My current setup;

ISP modem/router

In router modus, so one LAN port is for the raspberry pi router, the other three ports are for settopboxes etc from the IPS (they need some simple network and there own DNS)
there are on 192.168.178.0/24

On one of the network ports;
Raspberry pi 4B router with an manageable switch. (so only using the one network port on my Pi) My own (lan) network in on this network, 192.168.1.0/24 on Openwrt 21.02.1

I only have one cat 6 cable from my router location to my living room, so there are two manageable switches with the one cat 6 cable as trunk. So two vlans (one from the ISP router and one from my private raspberry router) are going in the switch and on the other end the network is split again, so I have two separate networks in my living room, one for my ISP stuff and one for private use. coming from the same switch depending on what port you use.

What I want to do;

End the double NAT, so my ISP router needs to go in bridge mode, so the three lan cables, now in the ISP modem, need to go in the spare ports of my raspberry Pi switch on a new vlan.

So I need a extra LAN network om my OpenWRT router (Pi) on a new vlan network interface, with his own (or the default from my isp) dns servers and own ip range.

So probably a lot of text to ask how to setup an extra br-lan interface on a extra vlan.

/etc/config/network

`config interface 'loopback'
 option device 'lo'
 option proto 'static'
 option ipaddr '127.0.0.1'
 option netmask '255.0.0.0'
config globals 'globals'
 option ula_prefix 'fdad:b459:8594::/48'
config interface 'lan'
 option proto 'static'
 option ipaddr '192.168.1.1'
 option netmask '255.255.255.0'
 option ip6assign '60'
 option device 'br-lan'
config interface 'wan'
 option proto 'dhcp'
 option peerdns '0'
 list dns '84.200.69.80'
 list dns '84.200.70.40'
 option device 'eth0.10'
config interface 'wan6'
 option proto 'dhcpv6'
 option reqaddress 'try'
 option reqprefix 'auto'
 option peerdns '0'
 list dns '2001:1608:10:25::1c04:b12f'
 list dns '2001:1608:10:25::9249:d69b'
 option device 'eth0.10'
config interface 'vpnclient'
 option proto 'none'
 option device 'tun1'
config interface 'vpnserver'
 option proto 'none'
 option device 'tun0'
config device
 option name 'br-lan'
 option type 'bridge'
 list ports 'eth0.20'`

/etc/config/dhcp

config dnsmasq
 option domainneeded '1'
 option boguspriv '1'
 option filterwin2k '0'
 option localise_queries '1'
 option rebind_protection '1'
 option rebind_localhost '1'
 option local '/lan/'
 option domain 'lan'
 option expandhosts '1'
 option nonegcache '0'
 option authoritative '1'
 option readethers '1'
 option leasefile '/tmp/dhcp.leases'
 option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
 option nonwildcard '1'
 option localservice '1'
 option ednspacket_max '1232'
 option confdir '/tmp/dnsmasq.d'
config dhcp 'lan'
 option interface 'lan'
 option start '100'
 option limit '150'
 option leasetime '12h'
 option dhcpv4 'server'
 option dhcpv6 'server'
 option ra 'server'
 list ra_flags 'managed-config'
 list ra_flags 'other-config'
 list dhcp_option '6,192.168.1.194'
config dhcp 'wan'
 option interface 'wan'
 option ignore '1'
 list ra_flags 'none'
config odhcpd 'odhcpd'
 option maindhcp '0'
 option leasefile '/tmp/hosts/odhcpd'
 option leasetrigger '/usr/sbin/odhcpd-update'
 option loglevel '4'

There are 3 different considerations here:

  1. Does your modem support bridge mode
    2a) Do your STBs continue to function as-is when the modem is in bridge mode? Depending on how the ISP handles the STB connections, they may or may not work this way.
    2b) If your STBs do not work as-is with the modem in bridge mode, do you have the relevant information about how to configure a VLAN for them to operate? This may or may not be possible; if it is possible, it may or may not be officially supported by the ISP.
  2. If 1 and 2 end up with dead-ends, does the modem support the ability to configure static routes (when it is operating in router mode)?

Yes it supports bridge mode, and after setting it in bridge mode it's an ordinairy cable modem.

Yes the STB works when on bridge mode (tested) but it works best on the dns from my isp and seperated from the rest from my network.

The whole idea is to skip the double nat, because al my connections from my Pi router, are only one connection on the isp router and it's on it's limits for the amount of users/devices on this one connection.

Ok... so, yeah... should be no issue.

You don't need to create another bridge for additional VLANs. It is actually as simple as creating a new network interface and binding it against the device eth0.x where x is the VLAN ID you want to use.

Just as an example, it could look like this:

config interface 'iptv'
   option proto 'static'
   option ipaddr '10.5.10.1'
   option netmask '255.255.255.0'
   option device 'eth0.10'

You will probably want to have a DHCP server configured for this network -- that is where you can specify the desired DNS servers to advertise to the STBs (do this with DHCP option 6).

And then you'll assign this new network to a firewall zone (or create a new zone) and set the desired rules.

Obviously, you also need to configure your managed switch to handle the additional VLAN on the ports.

1 Like

Do I need to set rules to make the dhcp work?

I just made a vlan, with the DHCP settings and made a new firewall rule for it (by the way, it doesn't work when I add the vlan to the lan firewall rule, so I gues that that is not the issue)

Offcourse I a configured a port on my switch for the vlan :wink: so I can test.

Firewall rules? Yes, you'll need to ensure that the firewall permits, at the minimum, UDP ports 67-68 (DHCP) as input (to the router) from the zone associated with the new network. If your router will also serve DNS on that network, you'll also want TCP/UDP port 53 open (but you said those devices are best used with the DNS from the ISP, so you don't need port 53 in that case).

If you want a review of what you've done so far, post the following:

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/dhcp
cat /etc/config/firewall

Ok thanks, here are my config files

cat /etc/config/network


config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fdad:b459:8594::/48'

config interface 'lan'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option device 'br-lan'

config interface 'wan'
	option proto 'dhcp'
	option peerdns '0'
	list dns '84.200.69.80'
	list dns '84.200.70.40'
	option device 'eth0.10'

config interface 'wan6'
	option proto 'dhcpv6'
	option reqaddress 'try'
	option reqprefix 'auto'
	option peerdns '0'
	list dns '2001:1608:10:25::1c04:b12f'
	list dns '2001:1608:10:25::9249:d69b'
	option device 'eth0.10'

config interface 'vpnclient'
	option proto 'none'
	option device 'tun1'

config interface 'vpnserver'
	option proto 'none'
	option device 'tun0'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0.20'

config interface 'ziggo_lan'
	option proto 'static'
	option ipaddr '192.168.180.1'
	option netmask '255.255.255.0'
	option device 'eth0.30'


cat /etc/config/dhcp


config dnsmasq
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'
	option confdir '/tmp/dnsmasq.d'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'
	list dhcp_option '6,192.168.1.194'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'
	list ra_flags 'none'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config domain
	option name 'router.lan'
	option ip '192.168.1.1'

config host
	option name 'raspberrypi'
	option ip '192.168.1.172'
	option mac 'XXXXXX'



config dhcp 'ziggo_lan'
	option interface 'ziggo_lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	list dhcp_option '684.200.69.80,84.200.70.40'
	list ra_flags 'none'


cat /etc/config/firewall


config defaults
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option synflood_protect '1'

config zone 'lan'
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	list device 'tun+'
	list network 'lan'
	list network 'vpnserver'

config zone
	option name 'ziggo_lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	list network 'ziggo_lan'

config zone 'wan'
	option name 'wan'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'wan'
	list network 'wan6'
	list network 'WANTETH'
	list network 'TETHERINGWAN'

config zone
	option name 'vpnclient'
	option output 'ACCEPT'
	option forward 'REJECT'
	list network 'tun1'
	list network 'vpnclient'
	option input 'REJECT'
	option masq '1'

config forwarding
	option src 'lan'
	option dest 'wan'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option src_ip 'fc00::/6'
	option dest_ip 'fc00::/6'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config rule
	option name 'Support-UDP-Traceroute'
	option src 'wan'
	option dest_port '33434:33689'
	option proto 'udp'
	option family 'ipv4'
	option target 'REJECT'
	option enabled '0'

config include
	option path '/etc/firewall.user'

config redirect
	option target 'DNAT'
	option name 'http'
	option src 'wan'
	option src_dport '80'
	option dest 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '80'

config redirect
	option target 'DNAT'
	option name 'NAS https'
	option src 'wan'
	option src_dport '443'
	option dest 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '443'

config forwarding
	option src 'lan'
	option dest 'vpnclient'

config nat
	option name 'Prevents hardcoded DNS clients error'
	list proto 'tcp'
	list proto 'udp'
	option src 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '53'
	option target 'MASQUERADE'

config redirect
	option target 'DNAT'
	option name 'Mailserver '
	option src 'wan'
	option src_dport '25'
	option dest 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '25'

config redirect
	option target 'DNAT'
	option name 'Mailserver'
	option src 'wan'
	option src_dport '465'
	option dest 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '465'

config redirect
	option target 'DNAT'
	option name 'Mailserver'
	option src 'wan'
	option src_dport '587'
	option dest 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '587'

config redirect
	option target 'DNAT'
	option name 'Mailserver'
	option src 'wan'
	option src_dport '995'
	option dest 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '995'

config redirect
	option target 'DNAT'
	option name 'Mailserver'
	option src 'wan'
	option src_dport '993'
	option dest 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '993'

config redirect
	option target 'DNAT'
	option name 'ssl nas '
	option src 'wan'
	option src_dport '5051'
	option dest 'lan'
	option dest_ip '192.168.1.194'
	option dest_port '5051'

config redirect
	option target 'DNAT'
	option name 'Redirect dns through pi-hole'
	option src 'lan'
	option src_ip '192.168.1.194'
	option src_dport '53'
	option dest 'lan'
	option dest_port '53'
	option dest_ip '192.168.1.194'

config rule 'ovpn'
	option name 'Allow-OpenVPN'
	option src 'wan'
	option dest_port '1194'
	option proto 'udp'
	option target 'ACCEPT'

config forwarding
	option src 'ziggo_lan'
	option dest 'wan'

config rule
	option name 'dhcp vlan ziggo'
	option src 'ziggo_lan'
	option dest_port '67-68'
	option target 'ACCEPT'
	list proto 'udp'


Oh my g.. I made a typo, ;-( it works for ip4 now :wink:

list dhcp_option '684.200.69.80,84.200.70.40'

Instead off

list dhcp_option '6,84.200.69.80,84.200.70.40'

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.