时间:2024-12-31 18:00:47
linux修改网卡ip命令
在Linux中修改网卡IP的命令有以下几种方法:
1. 使用ifconfig命令:在命令提示符后面输入`sudo ifconfig eth0 new_IP_address netmask new_netmask up`,其中eth0是网卡的接口,new_IP_address是需要设置的IP,new_netmask是子网掩码,up表示启用网卡。例如:`sudo ifconfig eth0 192.168.1.11 netmask 255.255.255.0 up`。
2. 使用nmcli工具:首先使用`sudo nmclicon add con-name "my-network" ifname "eth0" type ethernet ip4 "192.168.1.11/24" gw4 "192.168.1.1"`添加网卡配置到nmcli文件中,然后使用`sudo nmclicon up my-network`命令修改网卡IP。
需要注意的是,修改IP需在root用户下才行。
快测评广州东远堂信息科技有限公司版权所有 网站地图提供支持 粤ICP备15011623号