# ipadm create-addr -T static -a local=192.168.1.2/24 net0/v4
# ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
net0/v4 static ok 192.168.1.2/24 新增
net0/test1 static ok 192.168.1.3/28
net0/test2 static ok 192.168.2.3/28 準備移除
lo0/v6 static ok ::1/128
net0/v6 addrconf ok fe80::a00:27ff:fe3f:2d92/10
# ipadm delete-addr net0/test2
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
net0/v4 static ok 192.168.1.2/24 新增
net0/test1 static ok 192.168.1.3/28
net0/test2 static ok 192.168.2.3/28 準備移除
lo0/v6 static ok ::1/128
net0/v6 addrconf ok fe80::a00:27ff:fe3f:2d92/10
# ipadm delete-addr net0/test2
# ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
net0/v4 static ok 192.168.1.2/24
net0/test1 static ok 192.168.1.3/28
net0/test2 static ok 192.168.2.3/28 此時以經移除掉
lo0/v6 static ok ::1/128
net0/v6 addrconf ok fe80::a00:27ff:fe3f:2d92/10
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
net0/v4 static ok 192.168.1.2/24
net0/test1 static ok 192.168.1.3/28
lo0/v6 static ok ::1/128
net0/v6 addrconf ok fe80::a00:27ff:fe3f:2d92/10
新增gateway
# route -p add default 192.168.1.128
add net default: gateway 192.168.1.128
add persistent net default: gateway 192.168.1.128
# netstat -nr 檢視routing table
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
default 192.168.1.128 UG 2 1 192.168.1.128為gateway
127.0.0.1 127.0.0.1 UH 2 32 lo0
192.168.1.0 192.168.1.3 U 3 336 net0
192.168.1.0 192.168.1.11 U 3 1 net0
Routing Table: IPv6
Destination/Mask Gateway Flags Ref Use If
--------------------------- --------------------------- ----- --- ------- -----
::1 ::1 UH 2 0 lo0
fe80::/10 fe80::a00:27ff:fe3f:2d92 U 2 0 net0
變更gateway
# route -f add default 192.168.1.254
default 192.168.1.128 done
add net default: gateway 192.168.1.254
# netstat -nr
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
default 192.168.1.254 UG 2 1 變更gateway為192.168.1.254
127.0.0.1 127.0.0.1 UH 2 32 lo0
192.168.1.0 192.168.1.3 U 3 364 net0
192.168.1.0 192.168.1.11 U 3 1 net0
Routing Table: IPv6
Destination/Mask Gateway Flags Ref Use If
--------------------------- --------------------------- ----- --- ------- -----
::1 ::1 UH 2 0 lo0
fe80::/10 fe80::a00:27ff:fe3f:2d92 U 2 0 net0
root@ai-client:~#
沒有留言:
張貼留言