My device is AR71XX . It has eth0 and eth1(4 ethernet port and 0 port to cpu).
root@ACU:~# swconfig dev eth1 help
switch0: eth1(AR934X built-in switch), ports: 5 (cpu @ 0), vlans: 16
--switch
Attribute 1 (int): enable_vlan (Enable VLAN mode)
Attribute 2 (none): apply (Activate changes in the hardware)
Attribute 3 (none): reset (Reset the switch)
--vlan
Attribute 1 (int): vid (VLAN ID)
Attribute 2 (ports): ports (VLAN port mapping)
--port
Attribute 1 (int): pvid (Primary VLAN ID)
Attribute 2 (unknown): link (Get port link information)
root@ACU:~# swconfig dev switch0 help
switch0: eth1(AR934X built-in switch), ports: 5 (cpu @ 0), vlans: 16
--switch
Attribute 1 (int): enable_vlan (Enable VLAN mode)
Attribute 2 (none): apply (Activate changes in the hardware)
Attribute 3 (none): reset (Reset the switch)
--vlan
Attribute 1 (int): vid (VLAN ID)
Attribute 2 (ports): ports (VLAN port mapping)
--port
Attribute 1 (int): pvid (Primary VLAN ID)
Attribute 2 (unknown): link (Get port link information)
I can't find the VLAN configuration in LUCI. Is there a VLAN configuration WEB in LUCI ?
And I want to configure the network like this. I connect eth0 with trunk of external device.
The external device has two network (vlan1 and vlan178). VLAN1 is static(172.30.0.137) and VLAN178 is DHCP(192.170.2.97).
PC1 connect to port1 of eth1 . PC2 connect to port2 of eth1. I hope PC1 can access 172.30.0.137 and PC2 can access 192.170.2.97.
Can this be achieved? And how to configure the VLAN with OPENWRT?
For eth0 you need to create new interfaces with the .X suffix for each vlan you want to use. For example eth0.1 and eth0.178
Then you need to assign the physical ports of eth1 to the VLAN you want to use. For example port3 should be on VLAN1 untagged and port1 on VLAN178 untagged.
Finally you need to bridge the subinterfaces that belong to the same VLAN in order to be able to communicate with each other.
It should be called "Switch" under the "Network" drop down list.
You can also configure it directly in /etc/config/network file.
The driver only supports a limited table of VLANs, often 16 or 128. You’ll need to specify the vid explicitly rather than letting it default. Look at vid and pvid notes on the switch reference page.
In the switch configuration section, you should add both the LAN ports (untagged) and the CPU port for eth1 (tagged) on each VLAN that you are creating.
And my computer can get the DHCP IP of VLAN178 from port 1 of eth1.
Lan1 can access to 172.30.0.137, but my computer (172.30.0.138) can't access to 172.30.0.137 from port 2 of eth1. Why?
ping 172.30.0.137
PING 172.30.0.137 (172.30.0.137): 56 data bytes
64 bytes from 172.30.0.137: seq=0 ttl=64 time=1.070 ms
64 bytes from 172.30.0.137: seq=1 ttl=64 time=0.879 ms
64 bytes from 172.30.0.137: seq=2 ttl=64 time=0.850 ms
64 bytes from 172.30.0.137: seq=3 ttl=64 time=0.979 ms
64 bytes from 172.30.0.137: seq=4 ttl=64 time=1.559 ms
64 bytes from 172.30.0.137: seq=5 ttl=64 time=0.905 ms
swconfig dev switch0 show
root@ACU:~# swconfig dev switch0 show
Global attributes:
enable_vlan: 1
Port 0:
pvid: 1
link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
pvid: 10
link: port:1 link:up speed:100baseT full-duplex auto
Port 2:
pvid: 1
link: port:2 link:down
Port 3:
pvid: 1
link: port:3 link:up speed:100baseT full-duplex auto
Port 4:
pvid: 1
link: port:4 link:down
VLAN 1:
vid: 1
ports: 0t 2 3 4
VLAN 10:
vid: 178
ports: 0t 1
And I have another question when I change switch configuration to this
And my computer can get the DHCP IP of VLAN178 from port 1 of eth1.
Lan1 can access to 172.30.0.137, but my computer (172.30.0.138) can't access to 172.30.0.137 from port 2 of eth1. Why?
ping 172.30.0.137
PING 172.30.0.137 (172.30.0.137): 56 data bytes
64 bytes from 172.30.0.137: seq=0 ttl=64 time=1.070 ms
64 bytes from 172.30.0.137: seq=1 ttl=64 time=0.879 ms
64 bytes from 172.30.0.137: seq=2 ttl=64 time=0.850 ms
64 bytes from 172.30.0.137: seq=3 ttl=64 time=0.979 ms
64 bytes from 172.30.0.137: seq=4 ttl=64 time=1.559 ms
64 bytes from 172.30.0.137: seq=5 ttl=64 time=0.905 ms
swconfig dev switch0 show
root@ACU:~# swconfig dev switch0 show
Global attributes:
enable_vlan: 1
Port 0:
pvid: 1
link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
pvid: 10
link: port:1 link:up speed:100baseT full-duplex auto
Port 2:
pvid: 1
link: port:2 link:down
Port 3:
pvid: 1
link: port:3 link:up speed:100baseT full-duplex auto
Port 4:
pvid: 1
link: port:4 link:down
VLAN 1:
vid: 1
ports: 0t 2 3 4
VLAN 10:
vid: 178
ports: 0t 1
And I have another question when I change switch configuration to this
Can the hosts connected on the LAN ports ping the router?
Are ARP entries correct? (arp)
Run a tcpdump and see if the packets enter and exit the correct interfaces.
I hope you are not running and firewall, like iptables/ebtables.