linux 單網絡卡繫結多個IP

2021-10-09 17:53:07 字數 888 閱讀 7866

[linux]單網絡卡繫結多個ip

配置預設閘道器:

預設閘道器的檔案:/etc/sysconfig/network 內容如下:

其中test為主機名稱

networking=yes

hostname=test

gateway=192.168.168.250

或:nozeroconf=yes

gateway=10.230.17.1

eth0對應的配置檔案/etc/sysconfig/network-scripts/ifcfg-eth0內容如下:

device=eth0

bootproto=static

ipaddr=192.168.168.1

netmask=255.255.255.0

type=ethernet

onboot=yes

有時,我們需要在一塊網絡卡上配置多個ip,例如,我們還需要為eth0配置ip 192.168.168.2和192.168.168.3。那麼需要再在/etc/sysconfig/network-scripts下新建兩個配置檔案:

ifcfg-eth0:0內容如下:

device=eth0:0

bootproto=static

ipaddr=192.168.168.2

netmask=255.255.255.0

onboot=yes

ifcfg-eth0:1內容如下:

device=eth0:1

bootproto=static

ipaddr=192.168.168.3

netmask=255.255.255.0

onboot=yes

重啟網路生效:

systemctl restart network

Ubuntu 單網絡卡繫結多個IP

注 我的是eth0,但別的電腦可能不同,具體檢視命令ifconfig,將你電腦出現的ethx替換成下文的eth0 第一種方法 快遞建立 刪除虛擬網絡卡 sudo ifconfig eth0 0 192.168.10.10 up 以上的命令就可以在eth0網絡卡上建立乙個叫eth0 0的虛擬網絡卡,他...

linux 系統單網絡卡繫結多個IP位址方法

如果linux 系統只有乙個物理網絡卡,而在實際使用中,有時需要配置單網絡卡具備多個ip 位址。步驟 1 root登入 linux系統 2 檢視現有網路配置 root localhost cd etc sysconfig network scripts root localhost network ...

linux系統單網絡卡繫結雙IP的方法

linux系統單網絡卡繫結雙ip的方法 1.進入目錄 cd etc sysconfig network scripts advanced micro devices amd 79c970 pcnet32 lance device eth0 bootproto static broadcast 192...