openwrt roteia toda a comunicação de endereços IP específicos através da interface de rede virtual

0

Eu preciso alugar vários endereços IP do servidor DHCP e usar simultaneamente todos eles em um único computador.

Deve ser conectado da seguinte forma: computador com 5 endereços IP locais: 192.168.1.2-6 conectado por porta LAN ao roteador openwrt que alugou 5 endereços IP com 5 portas WAN virtuais, cada uma com um endereço MAC diferente.

Consegui que a segunda parte funcionasse com o pacote kmod-macvlan. Minha configuração está seguindo: /etc/rc.local:

ip link add link eth0.2 eth1 type macvlan
ifconfig eth1 hw ether 54:E6:FC:B7:00:00

ip link add link eth0.2 eth2 type macvlan
ifconfig eth2 hw ether 54:E6:FC:B7:00:01

ip link add link eth0.2 eth3 type macvlan
ifconfig eth3 hw ether 54:E6:FC:B7:00:02

ip link add link eth0.2 eth4 type macvlan
ifconfig eth4 hw ether 54:E6:FC:B7:00:03

ip link add link eth0.2 eth5 type macvlan
ifconfig eth5 hw ether 54:E6:FC:B7:00:04

ifup -a

/ etc / config / network:

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

config 'interface' 'lan'
    option 'ifname' 'eth0.1'
    option 'type' 'bridge'
    option 'proto' 'static'
    option 'ipaddr' '192.168.1.1'
    option 'netmask' '255.255.255.0'

config 'interface' 'wan'
    option 'ifname' 'eth0.2'
    option 'proto' 'dhcp'

config 'switch'
    option 'name' 'rtl8366rb'
    option 'reset' '1'
    option 'enable_vlan' '1'

config 'switch_vlan'
    option 'device' 'rtl8366rb'
    option 'vlan' '1'
    option 'ports' '1 2 3 4 5t'

config 'switch_vlan'
    option 'device' 'rtl8366rb'
    option 'vlan' '2'
    option 'ports' '0 5t'

config 'interface' 'wan1'
    option 'ifname' 'eth1'
    option 'proto' 'dhcp'
    option 'defaultroute' '0'
    option 'peerdns' '0'
    option 'gateway' '0.0.0.0'

config 'interface' 'wan2'
    option 'ifname' 'eth2'
    option 'proto' 'dhcp'
    option 'defaultroute' '0'
    option 'peerdns' '0'
    option 'gateway' '0.0.0.0'

config 'interface' 'wan3'
    option 'ifname' 'eth3'
    option 'proto' 'dhcp'
    option 'defaultroute' '0'
    option 'peerdns' '0'
    option 'gateway' '0.0.0.0'

config 'interface' 'wan4'
    option 'ifname' 'eth4'
    option 'proto' 'dhcp'
    option 'defaultroute' '0'
    option 'peerdns' '0'
    option 'gateway' '0.0.0.0'

config 'interface' 'wan5'
    option 'ifname' 'eth5'
    option 'proto' 'dhcp'
    option 'defaultroute' '0'
    option 'peerdns' '0'
    option 'gateway' '0.0.0.0'

ifconfig:

br-lan    Link encap:Ethernet  HWaddr 54:E6:FC:B7:**:**
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:168 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:17038 (16.6 KiB)  TX bytes:33230 (32.4 KiB)

eth0      Link encap:Ethernet  HWaddr 54:E6:FC:B7:**:**
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:719 errors:0 dropped:0 overruns:94459 frame:0
          TX packets:286 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:128743 (125.7 KiB)  TX bytes:57352 (56.0 KiB)
          Interrupt:4

eth0.1    Link encap:Ethernet  HWaddr 54:E6:FC:B7:**:**
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:219 errors:0 dropped:0 overruns:0 frame:0
          TX packets:206 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:24692 (24.1 KiB)  TX bytes:40289 (39.3 KiB)

eth0.2    Link encap:Ethernet  HWaddr 54:E6:FC:B7:**:**
          inet addr:192.168.99.8  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:180 errors:0 dropped:0 overruns:0 frame:0
          TX packets:70 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:31280 (30.5 KiB)  TX bytes:15492 (15.1 KiB)

eth1      Link encap:Ethernet  HWaddr 54:E6:FC:B7:00:00
          inet addr:192.168.99.101  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:89 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:17942 (17.5 KiB)  TX bytes:2476 (2.4 KiB)

eth2      Link encap:Ethernet  HWaddr 54:E6:FC:B7:00:01
          inet addr:192.168.99.102  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:83 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:16826 (16.4 KiB)  TX bytes:2065 (2.0 KiB)

eth3      Link encap:Ethernet  HWaddr 54:E6:FC:B7:00:02
          inet addr:192.168.99.103  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:76 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:15640 (15.2 KiB)  TX bytes:1259 (1.2 KiB)

eth4      Link encap:Ethernet  HWaddr 54:E6:FC:B7:00:03
          inet addr:192.168.99.104  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:69 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:15220 (14.8 KiB)  TX bytes:1259 (1.2 KiB)

eth5      Link encap:Ethernet  HWaddr 54:E6:FC:B7:00:04
          inet addr:192.168.99.105  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:81 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:16868 (16.4 KiB)  TX bytes:2293 (2.2 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:51 errors:0 dropped:0 overruns:0 frame:0
          TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4065 (3.9 KiB)  TX bytes:4065 (3.9 KiB)

Agora, como é que digo ao router para emparelhar os seguintes endereços de IP estáticos às portas WAN virtuais:

192.168.1.2 - eth1

192.168.1.3 - eth2

192.168.1.4 - eth3

192.168.1.5 - eth4

192.168.1.6 - eth6

A rede fica inacessível para 192.168.1.2 depois de entrar

ip route add 192.168.1.2 dev eth1
    
por LukAss741 16.09.2018 / 16:18

0 respostas