Linux Network


Linux Networkのメモ帳

 ip commndでの操作

ifconfig,route,netstat -> ip
に、コマンドが移行しつつあるので、自分用のメモ。
対比で、ifconfig,route,netstatでの場合も載せておく。
対応表が以下にあり。
https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/

確認コマンド


ifconfig -a

ip addr show
ip link show

物理リンクアップ/ダウン


ifconfig eth0 up
ip link set eth0 up

ifconfig eth0 down
ip link set eth0 down

ip address assign or remove


ifconfig eth0  192.168.11.1
ip address add 192.168.11.1/24 dev eth0

ifconfig eth0 0.0.0.0
ip address del 192.168.11.1/24 dev eth0

routing table 表示


route
netstat -r
ip route show

route 追加


route add default gw 192.168.11.1
ip route add default via 192.168.11.1 dev eth0 proto static

route add 10.8.41.0/24 gw 192.168.11.2
ip route add 10.8.41.0/24 via 192.168.11.2 dev eth0

route 削除


route del default
ip route del default

route del 10.8.41.0/24
ip route del 10.8.41.0/24

vlan

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