侧边栏壁纸
博主头像
★街角晚灯★博主等级

博观而约取 厚积而薄发

  • 累计撰写 461 篇文章
  • 累计创建 184 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

Ubuntu单个网卡绑定多个ip

WinJay
2013-07-26 / 0 评论 / 0 点赞 / 168 阅读 / 2278 字 / 正在检测是否收录...
温馨提示:
文章发布较早,内容可能过时,阅读注意甄别。。。。

常常我们有需要一个网卡像windows一样设置多个IP。

下面我们看看在ubuntu下怎么样做.

我们先打开网络接口的文件
sudo vi /etc/network/interfaces
会看到
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface auto eth0
iface eth0 inet static
address 202.205.XXX.XX
netmask 255.XXX.XXX.X
network 202.205.XXX.XX
broadcast 202.205.XXX.XXX
gateway 202.205.XXX.XX
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.205.XXX.XX

照上边eth0添加eth0:0

auto eth0:0
iface eth0:0 inet static
name Ethernet
address 202.205.XXX.XX
netmask 255.XXX.XXX.X
network 202.205.XXX.XX
broadcast 202.205.XXX.XXX
gateway 202.205.XXX.XX
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.205.XXX.XX

重启服务
sudo /etc/init.d/networking restart
测试新的ip地址是否生效
ping 202.205.XXX.XX
ping
202.205.XXX.XX

==============以上为添加同一网段内的IP地址=================

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区