User Tools

Site Tools


doc:uci:routing_in_ipv4
This wiki is read only and for archival purposes only. >>>>>>>>>> Please use the new OpenWrt wiki at https://openwrt.org/ <<<<<<<<<<

Routing with IPv4

For creating a basic network configuration in IPv4 like it shows in the picture. Click here: IPv4 config

In this example, we will use 3 routers and 2 stations (computers)

R1

The following configuration is for the Router "R1" which is located in the directory /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 'eth1' # option type 'bridge' option proto 'static' option ipaddr '172.16.1.1' option netmask '255.255.255.0' option ip6assign '60' config interface 'lan2' option ifname 'eth0' option proto 'static' option ipaddr '10.1.1.1' option netmask '255.255.255.252' config interface 'wan' option ifname 'eth1' option proto 'dhcp' config interface 'wan6' option ifname 'eth1' option proto 'dhcpv6' config globals 'globals' option ula_prefix 'fd58:c7b9:863f::/48' config route 'default' option interface 'lan2' option target '0.0.0.0' option netmask '0.0.0.0' option gateway '10.1.1.2'

WAN

For the "WAN" router which is located is also placed the directory /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' # option type 'bridge' option proto 'static' option ipaddr '10.1.1.2' option netmask '255.255.255.252' option ip6assign '60' config interface 'lan2' option ifname 'eth1' option proto 'static' option ipaddr '10.2.2.2' option netmask '255.255.255.252' config interface 'wan' option ifname 'eth1' option proto 'dhcp' config interface 'wan6' option ifname 'eth1' option proto 'dhcpv6' config globals 'globals' option ula_prefix 'fd58:c7b9:863f::/48' config route 'network' option interface 'lan' option target '172.16.1.0' option netmask '255.255.255.0' option gateway '10.1.1.1' config route 'network2' option interface 'lan2' option target '172.16.2.0' option netmask '255.255.255.0' option gateway '10.2.2.1'

R2

Finally for the "R2" router which is located is also placed the directory /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 'eth1' # option type 'bridge' option proto 'static' option ipaddr '10.2.2.1' option netmask '255.255.255.252' option ip6assign '60' config interface 'lan2' option ifname 'eth0' option proto 'static' option ipaddr '172.16.2.1' option netmask '255.255.255.0' config interface 'wan' option ifname 'eth1' option proto 'dhcp' config interface 'wan6' option ifname 'eth1' option proto 'dhcpv6' config globals 'globals' option ula_prefix 'fd58:c7b9:863f::/48' config route 'default' option interface 'lan' option target '0.0.0.0' option netmask '0.0.0.0' option gateway '10.2.2.2'

PC configuration

For the pc configuration, we just set up the IP addresses in each station.

PC1 IP 172.16.1.3 netmask 255.255.255.0 gateway 172.16.1.1
PC2 ip 172.16.2.3 netmask 255.255.255.0 gateway 172.16.2.1
doc/uci/routing_in_ipv4.txt · Last modified: 2018/01/12 00:46 by materazzi9