1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | vyos@vyos:~$ configure [edit] vyos@vyos# set interfaces ethernet eth1 address 10.20.10.1/24 [edit] vyos@vyos# set interfaces ethernet eth1 description 'to-m1' [edit] vyos@vyos# set interfaces ethernet eth2 address 192.168.10.1/24 [edit] vyos@vyos# set interfaces ethernet eth2 description 'to-m2' [edit] vyos@vyos# commit [edit] vyos@vyos# run show interfaces Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down Interface IP Address S/L Description --------- ---------- --- ----------- eth0 172.16.77.184/24 u/u OUTSIDE eth1 10.20.10.1/24 u/u to-m1 eth2 192.168.10.1/24 u/u to-m2 lo 127.0.0.1/8 u/u ::1/128 [edit] |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | vyos@vyos:~$ show interfaces Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down Interface IP Address S/L Description --------- ---------- --- ----------- eth0 172.16.77.185/24 u/u manage eth1 - u/u eth2 - u/u lo 127.0.0.1/8 u/u ::1/128 vyos@vyos:~$ configure [edit] vyos@vyos# set interfaces ethernet eth1 address 192.168.202.3/24 [edit] vyos@vyos# set interfaces ethernet eth1 description 'to-r1' [edit] vyos@vyos# set interfaces ethernet eth2 address 192.168.10.1/24 [edit] vyos@vyos# set interfaces ethernet eth2 description 'to-m2' [edit] vyos@vyos# commit [edit] vyos@vyos# save Saving configuration to '/config/config.boot'... Done [edit] vyos@vyos# exit exit vyos@vyos:~$ show interfaces Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down Interface IP Address S/L Description --------- ---------- --- ----------- eth0 172.16.77.185/24 u/u manage eth1 192.168.202.3/24 u/u to-r1 eth2 192.168.10.1/24 u/u to-m2 lo 127.0.0.1/8 u/u ::1/128 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | >>> from vyroute.Router import BasicRouter >>> vyos1 = BasicRouter('172.16.77.184','vyos:vyos') >>> vyos1.login {'Result': 'Login successfully.'} >>> vyos1.status {'commit': None, 'object': 'login', 'configure': None, 'save': None} >>> vyos1.configure {'Result': 'Active configure mode successfully.'} >>> static = {'config':{'target':'10.20.10.0/24','next-hop':'10.20.10.1','distance':'1'},} >>> vyos1.static_route(static) {'Result': 'Configured successfully'} >>> vyos1.commit_config {'Result': 'Commit successfully.'} >>> vyos1.exit_config(force=True) {'Result': 'Exit configure mode successfully.'} >>> vyos1.status {'commit': None, 'object': 'login', 'configure': 'No', 'save': None} >>> vyos1.logout {'Result': 'Logout successfully.'} >>> vyos1.status {'commit': None, 'object': 'logout', 'configure': None, 'save': None} |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | >>> vyos1.login {'Result': 'Login successfully.'} >>> vyos1.status {'commit': None, 'object': 'login', 'configure': None, 'save': None} >>> vyos1.static_route(static) {'Error': 'You are not in configure mode.'} >>> vyos1.configure {'Result': 'Active configure mode successfully.'} >>> vyos1.static_route(static) {'Result': 'Configured successfully'} >>> vyos1.exit_config {'Error': 'You should commit first.'} >>> vyos1.commit_config {'Result': 'Commit successfully.'} >>> vyos1.exit_config {'Error': 'You should save first.'} >>> vyos1.save_config {'Result': 'Save successfully.'} >>> vyos1.status {'commit': 'Yes', 'object': 'login', 'configure': 'Yes', 'save': 'Yes'} >>> vyos1.exit_config {'Result': 'Exit configure mode successfully.'} >>> vyos1.logout {'Result': 'Logout successfully.'} |
欢迎光临 51学通信论坛2017新版 (http://bbs.51xuetongxin.com/) | Powered by Discuz! X3 |