OpenWrt下手动设置静态DHCP及网络设置
方法一
修改/etc/config/dhcp,增加如下的内容:
config host
option ip ‘192.168.1.2’
option mac ’00:11:22:33:44:55′
option name ‘mypc’
方法二
dnsmasq读取 /etc/ether
/etc/init.d/dnsmasq -> option readethers 1
在/etc/ether中增加如下内容即可实现mac地址与IP地址的绑定
# mac ip
11:22:33:44:55:66 192.168.1.3
00:1c:cc:83:d9:2a 192.168.1.164
最后还需要重启dnsmasq
/etc/init.d/dnsmasq restart
注意点:如果需要绑定IP的设备之前一直处于连接到路由器的状态,需要断开连接后再次连接路由器才可以获得所设置的绑定的地址。
网络设置
vi /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd1c:dba9:060f::/48'
option packet_steering '1'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth1'
config interface 'LAN'
option device 'eth0'
option proto 'static'
option ipaddr '192.168.10.3'
option netmask '255.255.255.0'
list dns '192.168.10.2'
option gateway '192.168.10.2'
config device
option name 'eth0'
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。