vpp 通過配置檔案配置介面
阿新 • • 發佈:2020-08-21
startup-config /path_to_config_file
配置TenGigabitEthernet4/0/0的ip地址和埠狀態 set interface state TenGigabitEthernet4/0/0 up set interface ip address TenGigabitEthernet4/0/0 2001:1a::1/64 # 配置預設路由 ip route add ::/0 via 2001:1a::2 # 配置GigabitEthernetb/0/0的ip地址和埠狀態 set interface state GigabitEthernetb/0/0 up set interfaceip address GigabitEthernetb/0/0 10.0.0.1/24 # 配置TenGigabitEthernet13/0/0的ip地址和埠狀態 set interface state TenGigabitEthernet13/0/0 up set interface ip address TenGigabitEthernet13/0/0 10.1.0.1/24 # 新建Loopback埠,配置loopback地址和埠狀態 loopback create-interface set interface ip address loop0 fc00:1::1/64 set interface state loop0 up
unix { nodaemon log /var/log/vpp/vpp.log full-coredump cli-listen /run/vpp/cli.sock gid vpp startup-config /etc/vpp/interface.txt }
root@gobgp:~# vi /etc/vpp/interface.txt set interface state GigabitEthernet7/0/0 up set interface ip address GigabitEthernet7/0/0 192.168.123.3/24
root@gobgp:~# systemctl restart vpp root@gobgp:~# vppctl show interface addr GigabitEthernet7/0/0 (up): L3 192.168.123.3/24 local0 (dn): root@gobgp:~# cat /etc/vpp/interface.txt set interface state GigabitEthernet7/0/0 up set interface ip address GigabitEthernet7/0/0 192.168.123.3/24 root@gobgp:~#
root@gobgp:~# ping 192.168.123.2 connect: Network is unreachable root@gobgp:~# vppctl _______ _ _ _____ ___ __/ __/ _ \ (_)__ | | / / _ \/ _ \ _/ _// // / / / _ \ | |/ / ___/ ___/ /_/ /____(_)_/\___/ |___/_/ /_/ vpp# ping 192.168.123.2 116 bytes from 192.168.123.2: icmp_seq=2 ttl=64 time=.1428 ms 116 bytes from 192.168.123.2: icmp_seq=3 ttl=64 time=.0896 ms 116 bytes from 192.168.123.2: icmp_seq=4 ttl=64 time=.0839 ms 116 bytes from 192.168.123.2: icmp_seq=5 ttl=64 time=.0847 ms root@gobgp:~#