Setup vlans on router ASUS RT-AC68U with DD-WRT v24-sp2
Passwords, Wireless Security, and Initial Router SetupThis is a guide to setup 2 additional
VLANS on port 1 and 4 of the
RT-AC68U router using DD-WRT v24-sp2 (09/13/14) kongac. This configuration is for my home SmartDataCenter Admin and External networks, with the RT-AC68U WAN connected behind NAT on another router. The RT-AC68U router is a dual core ARMv7
800MHz Home Router that can be configured with advanced networking
features using the dd-wrt firmware. This router is robust and hard to
brick, thanks to built-in Asus tools that allow firmware flashes even
after things go bad. This is my 5th dd-wrt enabled router, each time I configure a new one I figure out something new about dd-wrt and networking. Generally speaking, it is a PITA to configure any dd-wrt router owing to the mix of Web UI and command line commands, but this particular router seems to work much better than previous ones I have used. Under dd-wrt, the router supports 96 Mb of jffs
filespace for local writable storage which seems plenty for this config. In this guide
vlan4:10.0.10.1 netmask 255.255.255.0 DHCP OFF, routed, with Local DNS vlan1:10.0.11.1 netmask 255.255.255.0 DHCP ON, firewalled, routed, with Local DNS Flashing the Router with dd-wrt Flashing is a 2 step process. First dd-wrt firmware flash from the ASUS firmware (http://192.168.1.1) Web UI on the Administration | Firmware Upgrade page with this BrainSlayer dd-wrt build: ftp://ftp.dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2014/06-23-2014-r24461/asus-rt-ac68u/asus_rt-ac68u-firmware.trx Reboot the router Second dd-wrt firmware flash from the above dd-wrt firmware (http://192.168.1.1) Web UI on the Administration | Firmware Upgrade page with: dd-wrt.v24-K3_AC_ARM_STD.bin This is a Kong Build [DD-WRT v24-sp2 (09/13/14) kongac] - originally at: http://www.desipro.de/ddwrt-ren/K3-AC-Arm/25015M/dd-wrt.v24-K3_AC_ARM_STD.bin More recent builds are listed at http://www.desipro.de/ddwrt-ren/K3-AC-Arm/ Note: The RT-AC68U firmware
recovery mode can be entered by booting with the reset
button down and holding it until a very slow power button flash happens.
Firmware can be uploaded from a Windows machine (via the CD-ROM
firmware update utility) or from the web browser version at 192.168.1.1
while in recovery mode (very slow power blink). (Adapted from instructions here: http://elatov.github.io/2014/11/dd-wrt-on-asus-rt-ac68u-router/) Connect via cable to LAN port 2, Power Up, Login via browser to http://192.168.1.1 Set initial page Username [root] and Password [************] Wireless | Basic Settings tab, Edit Both Sections! Wireless Physical Interface wl0 [2.4 GHz TurboQAM] 1. Wireless Network Name (SSID) [asus-dd-wrt] Wireless Physical Interface wl1 [5GHz/802.11ac] 2. Wireless Network Name (SSID) [asus-dd-wrt] 3. Click Save. Wireless Security wl0 1. Security Mode [WPA2 Personal] 2. WPA Shared Key [**********] Wireless Security wl1 3. Security Mode [WPA2 Personal] 4. WPA Shared Key [**********] 5. Click Save, then Apply Settings. Setup | Basic Setup tab, Edit:
Set up SSH Key Services | Services tab, Secure Shell Section, Edit:
Disallow Remote Access to the Router (Through the WAN). Administration | Management tab, Remote Access Section, Edit:
Administration | Management tab, JFFS2 Support section, Edit:.
cd /jffs (JFFS configuration adapted from: http://unfinishedbitness.info/2013/02/24/enabling-jffs-on-dd-wrt/) Configure VLANS Using the DD-WRT Web Interface, add vlan4 to port 4, vlan3 to port 1 Setup | VLAN tab - Edit:
Configure vlan3 and vlan4 network Setup | Networking tab, Port Setup section - Edit:
Add script to bring up the vlan3 & vlan4 interfaces on boot Administration | Commands tab
PATH="/sbin:/usr/sbin:/bin:/usr/bin:${PATH}" ifconfig vlan3 10.0.1.1 netmask 255.255.255.0 ifconfig vlan4 10.0.10.1 netmask 255.255.255.0 ifconfig vlan3 up ifconfig vlan4 up 2. Click Save Startup Use an SSH session into the router to enter these additional commands: nvram set vlan3hwname="et0" nvram set vlan4hwname="et0" nvram set vlan1ports="3 2 5*" nvram set vlan3ports="1 5" nvram set vlan4ports="4 5" nvram commit reboot (adapted from: http://virtuallyhyper.com/2014/04/tag-multiple-vlans-on-trunk-port-on-dd-wrt-router/ ) Reconnect to the Router Web UI, then set up the firewall rules for vlan3 and vlan4 Administration | Commands tab
iptables -I FORWARD -i vlan2 -o vlan+ -j ACCEPT Note - Allows connections between br0 (WiFi, Lan Ports 2,3) to/from vlan4 and vlan3 machines, this is a Minimal, Permissive Firewall state. You may want to firewall off vlan3 (Admin Network). The SDC system attached to vlan3 and vlan4 is behind NAT. The important security keeping people out is at the WiFi settings. If you want to allow guests access to the SDC External Network via WiFi connection or Lan ports 2 & 3, then you may want to firewall off vlan3. Enable Local DNS with DNSMasq Services | Services tab, Services Management section - Edit: Under DHCP Server heading:
interface=vlan4 9. Click Save, then Apply Settings then Reboot Router. You can test local DNS by using an SSH connection to the Router, and vi to create an appended hosts file: /jffs/etc/hosts.home When you make changes to this, use the DD-WRT Web UI Setup | Basic Setup - Apply Settings button to reset the hosts file to include the new changes. (adapted from: http://unfinishedbitness.info/2013/03/26/using-dd-wrt-for-local-dns-and-dhcp/) DONETroubleshooting PING TO WINDOWS? If
you are testing across vlans with PING - and using a Windows machine,
note that Windows Firewall blocks ping by default. Follow these instructions to enable Windows ICMPv4 PING echo: http://www.sysprobs.com/enable-ping-reply-windows-7 APPLY Button, Rebooting the Router and RECONNECTING Often
a browser will leave you at http://10.0.11.1/apply.cgi (I'm looking at
you Safari) and show only 10.0.11.1 in the top url window. Click on
this and delete the /apply.cgi (or other stuff) to reset to
http://10.0.11.1 and the dd-wrt system should reappear. If you still
don't reconnect, wait a bit longer (the router may be rebooting still)
or turn off the network connection and turn it back on again to reset
your computer's IP address via DHCP. If you still can't reconnect, you
may need to reset the Router's NVRAM: Resetting Router NVRAM To reset the RT-AC68U nvram externally, power off, hold down the WPS button (side of router), power on while holding the button until the power button flashes rapidly. This resets to factory DD-WRT installation settings, and the IP address will again be reset to 192.168.1.1 NOTE: This procedure does not affect the /jffs filesystem, which will persist through this process. To probe the original VLAN settings:
root@sdc:~# nvram show | grep vlan.hwnameFor RT-AC68U the default vlan is vlan1 (lan), vlan2 is (Wan). vlan2hwname=et0 vlan1hwname=et0 root@sdc:~# nvram show | grep vlan.ports size: 34245 bytes (31291 left) vlan2ports=0 5u vlan1ports=1 2 3 4 5* root@sdc:~# nvram show | grep port.vlan port5vlans=1 2 16 port3vlans=1 port1vlans=1 port4vlans=1 port2vlans=1 port0vlans=2 FINAL router CONFIG after following the above procedure: root@sdc:~# nvram show | grep vlan.hwname Chain INPUT (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 456 53640 ACCEPT 0 -- vlan+ * 0.0.0.0/0 0.0.0.0/0 19241 1222K ACCEPT 0 -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 0 0 ACCEPT udp -- vlan2 * 0.0.0.0/0 0.0.0.0/0 udp spt:67 dpt:68 0 0 DROP udp -- vlan2 * 0.0.0.0/0 0.0.0.0/0 udp dpt:520 0 0 DROP udp -- br0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:520 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:520 1354 143K ACCEPT 0 -- br0 * 0.0.0.0/0 0.0.0.0/0 0 0 DROP icmp -- vlan2 * 0.0.0.0/0 0.0.0.0/0 0 0 DROP 2 -- * * 0.0.0.0/0 0.0.0.0/0 4 296 ACCEPT 0 -- lo * 0.0.0.0/0 0.0.0.0/0 state NEW 0 0 ACCEPT 0 -- br0 * 0.0.0.0/0 0.0.0.0/0 state NEW 0 0 ACCEPT 0 -- vlan3 * 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT 0 -- vlan4 * 0.0.0.0/0 0.0.0.0/0 0 0 DROP 0 -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 2918 468K ACCEPT 0 -- vlan+ br0 0.0.0.0/0 0.0.0.0/0 3635 1878K ACCEPT 0 -- br0 vlan+ 0.0.0.0/0 0.0.0.0/0 471 69622 ACCEPT 0 -- vlan+ vlan2 0.0.0.0/0 0.0.0.0/0 610 443K ACCEPT 0 -- vlan2 vlan+ 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT 0 -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 0 0 ACCEPT 47 -- * vlan2 10.0.11.0/24 0.0.0.0/0 0 0 ACCEPT tcp -- * vlan2 10.0.11.0/24 0.0.0.0/0 tcp dpt:1723 0 0 ACCEPT 0 -- vlan3 * 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT 0 -- vlan4 * 0.0.0.0/0 0.0.0.0/0 0 0 lan2wan 0 -- * * 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT 0 -- br0 br0 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT 0 -- br0 vlan2 0.0.0.0/0 0.0.0.0/0 0 0 TRIGGER 0 -- vlan2 br0 0.0.0.0/0 0.0.0.0/0 TRIGGER type:in match:0 relate:0 0 0 trigger_out 0 -- br0 * 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT 0 -- br0 * 0.0.0.0/0 0.0.0.0/0 state NEW 0 0 DROP 0 -- * * 0.0.0.0/0 0.0.0.0/0 Chain OUTPUT (policy ACCEPT 332 packets, 25633 bytes) pkts bytes target prot opt in out source destination 19659 4244K ACCEPT 0 -- * br0 0.0.0.0/0 0.0.0.0/0 |