打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
ifconfig/route

ifconfig/route

 =================================DHCP自动分配IP================================

一般情况下,我们都是用dhcp自动获取IP,

/etc/init.d/networking restart  ----> 重启网络配置获取IP

invoke-rc.d networking restart  ----> 重启网络配置获取IP

或者安装dhcpcd,获取IP

root@Linux:/# dhcpcd

Usage: dhcpcd [options] <interface>

root@Linux:/# dhcpcd eth0

root@Linux:/# dhcpcd.sh: interface eth0 has been configured with new IP=192.168.1.112

 

 =================================手动指定IP================================

root@Linux:/# ifconfig eth0 192.168.1.108

 

Linux下设定了IP,还需绑定网关,

root@Linux:/# route add default gw 192.168.1.1    ---->> 切忌不是route add -host default gw 192.168.1.1

root@Linux:/# route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

使用这种方法添加的网关,在IP重设,网卡禁用/启用时,需重新设定.

ifconfig eth0 down

ifconfig eth0 up

==========================================================================
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
LINUX下的网络设置 ifconfig ,route
linux Dns问题 | Asterisk中国技术社区
Linux基础知识:网络属性配置
使用Linux构建路由器
Linux运维学习之如何取出网卡eth0的ip地址?
linux网络工具iproute2的使用简介
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服