目次

ipコマンド/IPエイリアス追加

IPエイリアス追加

このIP追加方法だと、secondaryとしてIPが追加される。

# ip addr add 192.168.100.5/24 brd 192.168.100.255 dev eth0

IP削除

# ip addr del 192.168.100.5/24 brd 192.168.100.255 dev eth0

IP確認

# ip -4 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 192.168.100.195/24 brd 192.168.100.255 scope global eth0
    inet 192.168.100.1/24 brd 192.168.100.255 scope global secondary eth0
    inet 192.168.100.5/24 brd 192.168.100.255 scope global secondary eth0

ipコマンドでVLANタグ追加

タグ追加

ip link add link eth1 name eth1.210 type vlan id 210

UP

ip link set eth1.210 up

Down

ip link set eth1.210 down

削除

ip link del eth1.210

IPコマンドGW

追加

ip route add default via 192.168.11.254

削除

ip route delete default

MTU変更

ip link set eth0 mtu 9000

VLANを付ける

eth0を使って、eth0.100としてvlan 100のNICを作成

ip link add link eth0 name eth0.100 type vlan id 100

Bonding作成

# ip link add bond0 type bond
# ip link set bond0 type bond miimon 100 mode 802.3ad
# ip link set eth0 down
# ip link set eth0 master bond0
# ip link set eth1 down
# ip link set eth1 master bond0
# ip link set bond0 up

仮想インターフェイス作成/Bridgeへ追加

ip link add name ethdummy10 type dummy
ip link set dev ethdummy10 master [bridge]
ip addr add 192.168.100.101/24 dev ethdummy10
ip link delete ethdummy10

Bridge関連

ブリッジ作成

ip link add <bridge> type bridge

ブリッジににインターフェイス追加

ip link set dev <if> master <bridge>

ブリジッジ確認

bridge link show
brctl show