路由表示例: IPv4

创建输入所示IPv4的基本网络配置

ipv4.jpeg

在这个例子中,我们将使用3台路由器和2台客户端pc。

# /etc/config/network
 
config interface 'lan'
	option ifname 'eth1'
	option proto 'static'
	option ipaddr '172.16.1.1'
	option netmask '255.255.255.0'
 
config interface 'wan'
	option ifname 'eth0'
	option proto 'static'
	option ipaddr '10.1.1.1'
	option netmask '255.255.255.252'
	option gateway '10.1.1.2'
# /etc/config/network
 
config interface 'lan'
	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 'static'
	option ipaddr '10.2.2.1'
	option netmask '255.255.255.252'
	option gateway '10.2.2.2'
# /etc/config/network
 
config interface 'lan1'
	option ifname 'eth0'
	option proto 'static'
	option ipaddr '10.1.1.2'
	option netmask '255.255.255.252'
 
config interface 'lan2'
	option ifname 'eth1'
	option proto 'static'
	option ipaddr '10.2.2.2'
	option netmask '255.255.255.252'
 
config route 'net1'
	option interface 'lan1'
	option target '172.16.1.0'
	option netmask '255.255.255.0'
	option gateway '10.1.1.1'
 
config route 'net2'
	option interface 'lan2'
	option target '172.16.2.0'
	option netmask '255.255.255.0'
	option gateway '10.2.2.1'

For the PCs 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
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2021/01/25 09:36
  • by shorile