1

I have a TP-Link WR1043ND with 1 wan and 1 lan cables attached. The lan cable currently have 2 ips of two different network, using an alias. The two networks share the same switch.

I'd like the router to forward between the two. Currently the routers sends ICMP redirect to the first network telling the clients to go to the second network directly, which is impossible.

Could I create a second virtual nic in the same vlan and assign it the IP on the second network?

Thanks!

the-wabbit
  • 40,737
  • 13
  • 111
  • 174
Sirber
  • 328
  • 5
  • 18

2 Answers2

2

This is not specific to OpenWRT but works with any Linux 2.6 - based distro. Just disable the sending of ICMP redirects for your aliased interface (assumed eth0 for the code examples):

echo "0" > /proc/sys/net/ipv4/conf/eth0/send_redirects

which would be effective until re-setting or reboot. To make the setting permanent add this line to /etc/sysctl.conf:

net.ipv4.conf.eth0.send_redirects = 0

and run sysctl -p to reload the configuration.

the-wabbit
  • 40,737
  • 13
  • 111
  • 174
  • yes, that could do it, but I'd like to have 2 nic with 1 ip each :) – Sirber Aug 01 '12 at 13:32
  • @Sirber in this case the simplest, most secure and best-documented way would be to use a VLAN-capable switch and tagged interfaces. – the-wabbit Aug 01 '12 at 19:16
  • I agree, but the main question is about a TP-Link WR1043ND and OpenWRT :) http://wiki.openwrt.org/toh/tp-link/tl-wr1043nd?s[]=1043nd#specific.configuration – Sirber Aug 01 '12 at 20:59
  • @Sirber is there anything in this constellation that would prevent you from using VLANs? OpenWRT does support them, the employed RTL8366RB chip does support them and you should use them - unless you *really* are willing to go the troubled road of [macvlan-interfaces](http://www.candelatech.com/~greear/vlan.html) or [veth-interfaces](https://dev.openwrt.org/browser/packages/net/veth). Don't do it. You have been warned. – the-wabbit Aug 01 '12 at 21:42
  • I tryed VLAN but I plugged it in the same switch. Linux does not support STP so the whole network went down. I installed dedicated wires and it works perfectly now. – Sirber Aug 14 '12 at 20:44
0

VLAN works using the GUI. enter image description here

I created a nic using VLAN 3 with the IP I wanted for the second network.

Since linux supports STP only for bridging I needed dedicated wires for the second nic. Plugging the second nic in the same switch as the LAN made the network going down.

Sirber
  • 328
  • 5
  • 18