海思V711平台4G模组上路由转发配置:
1、配置udhcpd.conf文件 vim /etc/udhcpd.conf
start 192.168.9.1 #定义地址池的开始地址
end 192.168.9.254 #定义地址池的结束地址
interface gmac0 #dhcp服务器中响应dhcp协议的接口
opt dns 8.8.8.8 219.239.26.42 #定义dns服务器地址
option subnet 255.255.255.0
opt router 192.168.9.1 #该地址为dhcp服务器中响应dhcp协议接口的IP地址
option dns 124.207.160.106 #dns server最多可以设置3个
option domain local
option lease 86400 #租约时间,单位为秒
static_lease 00:60:08:11:ce:4e 192.168.43.100 #静态绑定mac和IP地址
static_lease 00:60:08:11:ce:38 192.168.43.110
2、模块端加载gmac0端口
ifconfig gmac0 192.168.9.1 up //注意,用于PC端设置网关转发上网
执行如下指令,解决udhcpd error问题,若无错误则跳过。
3、启动udhcpd服务
udhcpd -f /etc/udhcpd.conf &
4、模块内部拨号上网
获取到访问外网的无线网卡
5、设置转发规则
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth_x -j MASQUERADE
6、PC端可直接上网
网关设置成模块端的ip地址才能上网