if interface 接口
config 配置
-a all
ifconfig -a
ifconfig -eth0
ifconfig eth0 up //打开eth0 网卡接口
ifconfig eth0 down //关闭eth0 网卡接口
//重启网络
关闭网络后可能会造成 network unreachable
所以要键入以下命令
/etc/init.d/networking restart
dh dhcp
client 客户端
//键入dhclient 命令 自动获取ip 网络必须启用了 dhcp协议
dhclient eth0
ifcofig eth0 IP netmask
route add default gw IP //配置网关
将 eth0 下 dhcp 改成
static
然后填入下面几条命令
address ip
netmask 255.255.255.0
gateway 网关
config 配置
-a all
ifconfig -a
ifconfig -eth0
ifconfig eth0 up //打开eth0 网卡接口
ifconfig eth0 down //关闭eth0 网卡接口
//重启网络
关闭网络后可能会造成 network unreachable
所以要键入以下命令
/etc/init.d/networking restart
dh dhcp
client 客户端
//键入dhclient 命令 自动获取ip 网络必须启用了 dhcp协议
dhclient eth0
ifcofig eth0 IP netmask
route add default gw IP //配置网关
系统配置文件中的是指ip等 是一直有效的
地址 /etc/network/interface
前面的命令 是临时的。将 eth0 下 dhcp 改成
static
然后填入下面几条命令
address ip
netmask 255.255.255.0
gateway 网关

本文详细介绍了Linux环境下使用ifconfig和DHCP命令进行网络接口配置的方法,包括开启、关闭网卡接口,重启网络,以及如何通过DHCP自动获取IP地址,并提供了永久配置网络接口的步骤。
1119

被折叠的 条评论
为什么被折叠?



