Nie, myliłem się. Działa to dobrze ot tak po prostu.
Dwa wany, konfiguracja:
root@OpenWrt:~# 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 'fd8d:1034:a2de::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.10.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wan'
option device 'eth1'
option proto 'dhcp'
option metric 10
config interface 'wan2'
option device 'eth2'
option proto 'dhcp'
option metric 20
Adresy jakie ma na wanach:
root@OpenWrt:~# ifstatus wan
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"dynamic": false,
"uptime": 673,
"l3_device": "eth1",
"proto": "dhcp",
"device": "eth1",
"updated": [
"addresses",
"routes",
"data"
],
"metric": 10,
"dns_metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "192.168.11.179",
"mask": 24
}
],
"ipv6-address": [
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
],
"route": [
{
"target": "0.0.0.0",
"mask": 0,
"nexthop": "192.168.11.1",
"source": "192.168.11.179/32"
}
],
"dns-server": [
"192.168.11.1"
],
"dns-search": [
"lan"
],
"neighbors": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
]
},
"data": {
"dhcpserver": "192.168.11.1",
"hostname": "OpenWrt",
"leasetime": 43200
}
}
root@OpenWrt:~# ifstatus wan2
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"dynamic": false,
"uptime": 128,
"l3_device": "eth2",
"proto": "dhcp",
"device": "eth2",
"updated": [
"addresses",
"routes",
"data"
],
"metric": 20,
"dns_metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "192.168.1.180",
"mask": 24
}
],
"ipv6-address": [
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
],
"route": [
{
"target": "0.0.0.0",
"mask": 0,
"nexthop": "192.168.1.1",
"source": "192.168.1.180/32"
}
],
"dns-server": [
"192.168.1.1"
],
"dns-search": [
"lan"
],
"neighbors": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
]
},
"data": {
"dhcpserver": "192.168.1.1",
"hostname": "OpenWrt",
"leasetime": 43200
}
}
I pingi z urządzeń na wanach:
root@OpenWrt:~# cat /tmp/dhcp.leases
1749958165 00:08:a2:0a:d0:0e 192.168.1.180 OpenWrt *
root@OpenWrt:~# ping 192.168.1.180
PING 192.168.1.180 (192.168.1.180): 56 data bytes
64 bytes from 192.168.1.180: seq=0 ttl=64 time=0.684 ms
64 bytes from 192.168.1.180: seq=1 ttl=64 time=0.543 ms
64 bytes from 192.168.1.180: seq=2 ttl=64 time=0.531 ms
64 bytes from 192.168.1.180: seq=3 ttl=64 time=0.555 ms
64 bytes from 192.168.1.180: seq=4 ttl=64 time=0.501 ms
^C
--- 192.168.1.180 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.501/0.562/0.684 ms
wan2:
root@MiFi:~# cat /tmp/dhcp.leases
1751750778 00:08:a2:0a:d0:0d 192.168.11.179 OpenWrt *
root@MiFi:~# ping 192.168.11.179
PING 192.168.11.179 (192.168.11.179): 56 data bytes
64 bytes from 192.168.11.179: seq=0 ttl=64 time=0.646 ms
64 bytes from 192.168.11.179: seq=1 ttl=64 time=0.485 ms
64 bytes from 192.168.11.179: seq=2 ttl=64 time=0.485 ms
64 bytes from 192.168.11.179: seq=3 ttl=64 time=0.494 ms
^C
--- 192.168.11.179 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.485/0.527/0.646 ms
root@MiFi:~#
W firewallu mam wan i wan2 przypisany do sekcji wan, reszta konfiguracji normalna jak fabryka dała.
Routing wygląda tak
root@OpenWrt:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.11.1 0.0.0.0 UG 10 0 0 eth1
0.0.0.0 192.168.1.1 0.0.0.0 UG 20 0 0 eth2
192.168.1.0 0.0.0.0 255.255.255.0 U 20 0 0 eth2
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lan
192.168.11.0 0.0.0.0 255.255.255.0 U 10 0 0 eth1
Lan to 192.168.10.x, wany na dhcp, dostały 192.168.1.x oraz 192.168.11.x I mogę z "internetu" pingować oba interfejsu, niezależnie od tego który jaką ma metrykę.
Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.