曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 2518|回复: 0
打印 上一主题 下一主题

命令行网络基本配置

[复制链接]

4917

主题

5879

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34382
跳转到指定楼层
楼主
发表于 2016-5-14 16:48:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1. 启动或停止网络服务
#/etc/init.d/networking start
#/etc/init.d/networking stop


2. 如果你有其它的网络管理器,那么可以如下关启默认的管理器:
#/etc/init.d/network-manager stop
#/etc/init.d/network-manager start
#/etc/init.d/network-manager restart


3. 启用网络接口,假设是 eth0 :
# ifconfig eth0 up


4. 使用 DHCP 获取网络地址:
# echo “iface eth0 inet dhcp” >>/etc/network/interfaces
# ifconfig eth0 up


4. 使用静态地址:
ifconfig eth0 192.168.1.100
ifconfig eth0 netmask 255.255.255.0
ifconfig eth0 broadcast 192.168.1.255



4.1 增加默认网关
route add default gw 192.168.1.1 eth0


5. 设置 DNS
echo “nameserver 8.8.8.8\n nameserver 8.8.4.4″ >>/etc/resolv.conf


相关帖子

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2024-5-7 08:03 , Processed in 0.079142 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表