sasika 写了:$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# 有线网卡
auto eth0
iface eth0 inet static
# IP 地址
address xxx.xxx.xxx.xxx
# 子网掩码
netmask 255.255.255.0
# 网关
gateway xxx.xxx.xxx.xxx
再 重启网卡
$ sudo ifdown eth0
$ sudo ifup eth0
ifconfig 可以看到结果了
但是为什么会成这样?
mzf@mzf-Aspire-5552G:~$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
mzf@mzf-Aspire-5552G:~$ auto lo
No command 'auto' found, did you mean:
Command 'uuto' from package 'uucp' (universe)
auto: command not found
mzf@mzf-Aspire-5552G:~$ iface lo inet loopback
iface: command not found
mzf@mzf-Aspire-5552G:~$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
mzf@mzf-Aspire-5552G:~$
mzf@mzf-Aspire-5552G:~$
mzf@mzf-Aspire-5552G:~$ # 有线网卡
mzf@mzf-Aspire-5552G:~$ auto eth0
No command 'auto' found, did you mean:
Command 'uuto' from package 'uucp' (universe)
auto: command not found
mzf@mzf-Aspire-5552G:~$ iface eth0 inet static
iface: command not found
mzf@mzf-Aspire-5552G:~$ # IP 地址
mzf@mzf-Aspire-5552G:~$ address 218.197.215.254
No command 'address' found, did you mean:
Command 'naddress' from package 'util-vserver' (universe)
address: command not found
mzf@mzf-Aspire-5552G:~$ # 子网掩码
mzf@mzf-Aspire-5552G:~$ netmask 255.255.255.0
255.255.255.0/32
mzf@mzf-Aspire-5552G:~$ # 网关
mzf@mzf-Aspire-5552G:~$ gateway 218.197.215.254
gateway: command not found
mzf@mzf-Aspire-5552G:~$