- 1. 输入命令查看现有的网络接口配置信息1 H. n' f& }2 m+ @& P
- uci show network
0 D) w" _; K( J- g2 I
# _4 E4 @( w7 z& x- 2. 接口名称通常为`lan`,使用以下命令配置网络7 L1 v. X4 o' x) m- ]
- uci set network.lan.ipaddr=<固定IP地址>( E9 M* a4 T/ K3 M
- uci set network.lan.netmask=<子网掩码>2 I/ o3 c6 |5 l1 z
- uci set network.lan.gateway=<默认网关IP>
! z p& l. }! W& e - uci set network.lan.dns=<DNS服务器IP>
+ ]: @5 p, R5 G1 g - " D& Y8 B4 c% t5 o& {
- 3. 保存并应用新的配置
: p/ M5 U" U4 S I a% x& n - uci commit network% K5 K6 q$ s7 ]$ H8 V
- /etc/init.d/network restart
8 N: k+ f0 |' V* y( `+ ~$ R - : w" Y; G8 N7 m5 h3 c
- 4. 刷新网络接口,使新的配置生效7 {! `6 C8 ]: x, I* G- I# |
- /etc/init.d/network reload
# z9 _6 E( P$ F- T) l3 n) l
5 E, R9 a0 K- i6 ?! E- 5. 查看配置结果. O9 M! n' C! B
- uci show network
8 W# L$ x7 \4 ?8 [- b6 \0 ~/ c - 或% N" _, D0 C1 U+ x# M$ ?. ~
- ip addr
! A( O2 e6 [( H$ m. ~) n
复制代码
* o, G2 G9 O: g1 H, U8 v# T: g7 P
! I! h4 n3 G3 @( _' j |