There is a global IPv4 address a.b.c.0/24
and I am assigned a part of them. I am also assigned IPv4 addresses a.b.d.e
, to which all packets destined to IP addresses a.b.c.x
- a.b.c.y
will be forwarded. It means that IP address a.b.d.e
is the next hop for IP addresses a.b.c.x
- a.b.c.y
.
Now, I am trying to build two routers using OpenWrt:
- The first router has IP address
a.b.d.e
and forwards all packets destined to IP addressa.b.c.x
to the second. - The second router has
a.b.c.x
and allows the computers under it to communicate with the outside world through these routers.
How should I configure the first router as the next hop for IP addresses a.b.c.x
?
I have tried changing various settings for static routes and firewalls, but through trial and error, I have encountered the following problem:
- The packets would come back to this router again and loop.
- When I accessed a.b.d.e from the outside with a browser, I would see LuCI.
- The first router was not seen in the results of traceroute from outside to
a.b.c.x
.
Current configure of the first router is following:
config interface 'lan'
option device 'br-lan'
option proto 'static'
option force_link '0'
option delegate '0'
list ipaddr 'a.b.c.1/24'
config device
option type 'bridge'
option name 'br-lan'
list ports 'eth2'
config interface 'wan'
option proto 'dhcp' ## dhcp will offer a.b.d.e
option delegate '0'
option device 'eth1.240'
config device
option name 'eth1.240'
option type '8021q'
option ifname 'eth1'
option vid '240'
option ipv6 '0'
option promisc '1'
config route ## this rule do not appear on route / ip route command
option interface 'lan'
option target 'a.b.c.0'
option netmask '255.255.255.0'
option gateway 'a.b.c.x'
option onlink '1'
option table 'main'