按照of-config源码安装完成后,就可以初步了解一下of-config是如何工作的。
开启ovs
# /usr/share/openvswitch/scripts/ovs-ctl start
Starting ovsdb-server [ OK ]
system ID not configured, please use --system-id ... failed!
Configuring Open vSwitch system IDs [ OK ]
Inserting openvswitch module [ OK ]
Starting ovs-vswitchd [ OK ]
Enabling remote OVSDB managers [ OK ]
ovs正确启动后,先查看一下ovs的配置
# ovs-vsctl show
f9e9e4ce-5b2d-431b-9146-72795a6cc751
Bridge ofc-bridge
fail_mode: secure
Port ofc-bridge
Interface ofc-bridge
type: internal
Port "eth1"
Interface "eth1"
type: internal
ovs_version: "2.3.1"
可以看到ovs有一个ofc-bridge网桥,ofc-bridge网桥上有两个端口ofc-bridge和eth1,其中端口ofc-bridge是of-config配置过程中自动配置好的,端口eth1是后来添加上去的。
启动of-config:
[root@localhost of-config]# ofc-server -v 3 -f
ofc-server[3411]: Shared memory location: /dev/shm/libnetconfshm
ofc-server[3411]: Shared memory file libnetconfshm already exists - opening
ofc-server[3411]: POSIX SHM File Descriptor: 4 (568B).
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model ietf-inet-types.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model ietf-yang-types.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model ietf-netconf-monitoring.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model ietf-netconf-notifications.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model nc-notifications.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model notifications.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model libnetconf-notifications.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model ietf-netconf-with-defaults.
ofc-server[3411]: Checking the default Events stream path //var/lib/libnetconf//streams/.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model ietf-x509-cert-to-name.
ofc-server[3411]: NACM turned off, module 'ietf-netconf-acm' is not available for import from 'ietf-netconf-server'.
ofc-server[3411]: ncds_new_internal: Relax NG validator set (/usr/local/var/ofconfig/ietf-netconf-server/ietf-netconf-server-config.rng)
ofc-server[3411]: ncds_new_internal: Schematron validator set (/usr/local/var/ofconfig/ietf-netconf-server/ietf-netconf-server-schematron.xsl)
ofc-server[3411]: Datastore ietf-netconf-server initiated with ID 1804289384.
ofc-server[3411]: ncds_features_parse: no feature definitions found in data model of-config.
ofc-server[3411]: ncds_new_internal: Relax NG validator set (/usr/local/var/ofconfig/of-config/of-config-config.rng)
ofc-server[3411]: ncds_new_internal: Schematron validator set (/usr/local/var/ofconfig/of-config/of-config-schematron.xsl)
ofc-server[3411]: Try to synchronize OVSDB.
2020-08-12T11:39:15Z|00001|reconnect|INFO|unix://var/run/openvswitch/db.sock: connecting...
2020-08-12T11:39:15Z|00002|reconnect|INFO|unix://var/run/openvswitch/db.sock: connected
ofc-server[3411]: OF-CONFIG datastore initialized.
ofc-server[3411]: Datastore of-config initiated with ID 846930887.
ofc-server[3411]: Setting default configuration for ietf-netconf-server module
ofc-server[3411]: callback_srv_netconf_srv_ssh_srv_listen_oneport: port 830
ofc-server[3411]: callback_srv_netconf_srv_ssh_srv_listen: started sshd (PID 3412)
ofc-server[3411]: OFC COPY-CONFIG (from <config> to running)
ofc-server[3411]: Deleting all OVSDB content
ofc-server[3411]: OVSDB transaction successful
ofc-server[3411]: OVSDB unchanged
ofc-server[3411]: OFC COPY-CONFIG (from startup to running)
ofc-server[3411]: Creating the node capable-switch
ofc-server[3411]: Creating the node id
ofc-server[3411]: Creating the node resources
ofc-server[3411]: Creating the node port
ofc-server[3411]: Creating the node logical-switches
ofc-server[3411]: Creating the node switch
ofc-server[3411]: OVSDB transaction successful
ofc-server[3411]: OpenFlow: connecting to unix://var/run/openvswitch/ofc-bridge.mgmt
ofc-server[3411]: OpenFlow: ofc-bridge: failed to connect to socket (Connection reset by peer).
ofc-server[3411]: OpenFlow: connecting to unix://var/run/openvswitch/ofc-bridge.mgmt
2020-08-12T11:39:16Z|00003|timeval|WARN|Unreasonably long 1001ms poll interval (0ms user, 0ms system)
ofc-server[3411]: ovs|00003|timeval|WARN|Unreasonably long 1001ms poll interval (0ms user, 0ms system)
2020-08-12T11:39:16Z|00004|timeval|WARN|faults: 10 minor, 0 major
ofc-server[3411]: ovs|00004|timeval|WARN|faults: 10 minor, 0 major
2020-08-12T11:39:16Z|00005|timeval|WARN|context switches: 1 voluntary, 0 involuntary
ofc-server[3411]: ovs|00005|timeval|WARN|context switches: 1 voluntary, 0 involuntary
2020-08-12T11:39:16Z|00006|coverage|INFO|Event coverage, avg rate over last: 5 seconds, last minute, last hour, hash=27900043:
ofc-server[3411]: ovs|00006|coverage|INFO|Event coverage, avg rate over last: 5 seconds, last minute, last hour, hash=27900043:
2020-08-12T11:39:16Z|00007|coverage|INFO|stream_open 0.0/sec 0.000/sec 0.0000/sec total: 5
ofc-server[3411]: ovs|00007|coverage|INFO|stream_open 0.0/sec 0.000/sec 0.0000/sec total: 5
2020-08-12T11:39:16Z|00008|coverage|INFO|hmap_pathological 0.0/sec 0.000/sec 0.0000/sec total: 21
ofc-server[3411]: ovs|00008|coverage|INFO|hmap_pathological 0.0/sec 0.000/sec 0.0000/sec total: 21
2020-08-12T11:39:16Z|00009|coverage|INFO|hmap_expand 0.0/sec 0.000/sec 0.0000/sec total: 94
ofc-server[3411]: ovs|00009|coverage|INFO|hmap_expand 0.0/sec 0.000/sec 0.0000/sec total: 94
2020-08-12T11:39:16Z|00010|coverage|INFO|vconn_open 0.0/sec 0.000/sec 0.0000/sec total: 4
ofc-server[3411]: ovs|00010|coverage|INFO|vconn_open 0.0/sec 0.000/sec 0.0000/sec total: 4
2020-08-12T11:39:16Z|00011|coverage|INFO|vconn_sent 0.0/sec 0.000/sec 0.0000/sec total: 2
ofc-server[3411]: ovs|00011|coverage|INFO|vconn_sent 0.0/sec 0.000/sec 0.0000/sec total: 2
2020-08-12T11:39:16Z|00012|coverage|INFO|util_xalloc 0.0/sec 0.000/sec 0.0000/sec total: 4064
ofc-server[3411]: ovs|00012|coverage|INFO|util_xalloc 0.0/sec 0.000/sec 0.0000/sec total: 4064
2020-08-12T11:39:16Z|00013|coverage|INFO|poll_fd_wait 0.0/sec 0.000/sec 0.0000/sec total: 16
ofc-server[3411]: ovs|00013|coverage|INFO|poll_fd_wait 0.0/sec 0.000/sec 0.0000/sec total: 16
2020-08-12T11:39:16Z|00014|coverage|INFO|poll_zero_timeout 0.0/sec 0.000/sec 0.0000/sec total: 2
ofc-server[3411]: ovs|00014|coverage|INFO|poll_zero_timeout 0.0/sec 0.000/sec 0.0000/sec total: 2
2020-08-12T11:39:16Z|00015|coverage|INFO|txn_unchanged 0.0/sec 0.000/sec 0.0000/sec total: 1
ofc-server[3411]: ovs|00015|coverage|INFO|txn_unchanged 0.0/sec 0.000/sec 0.0000/sec total: 1
2020-08-12T11:39:16Z|00016|coverage|INFO|txn_incomplete 0.0/sec 0.000/sec 0.0000/sec total: 3
ofc-server[3411]: ovs|00016|coverage|INFO|txn_incomplete 0.0/sec 0.000/sec 0.0000/sec total: 3
2020-08-12T11:39:16Z|00017|coverage|INFO|txn_success 0.0/sec 0.000/sec 0.0000/sec total: 2
ofc-server[3411]: ovs|00017|coverage|INFO|txn_success 0.0/sec 0.000/sec 0.0000/sec total: 2
2020-08-12T11:39:16Z|00018|coverage|INFO|47 events never hit
ofc-server[3411]: ovs|00018|coverage|INFO|47 events never hit
ofc-server[3411]: OpenFlow: ofc-bridge: successful connection.
ofc-server[3411]: Transapi calling callback /A:capable-switch with op ADD.
ofc-server[3411]: OF-CONFIG data affected.
ofc-server[3411]: OF-CONFIG server successfully initialized.
当出现OF-CONFIG server successfully initialized时,说明of-config启动成功。
启动netopeer-server:
[root@localhost of-config]# netopeer-server -v 3
netopeer-server[3465]: Shared memory location: /dev/shm/libnetconfshm
netopeer-server[3465]: Shared memory file libnetconfshm already exists - opening
netopeer-server[3465]: POSIX SHM File Descriptor: 4 (568B).
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model ietf-inet-types.
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model ietf-yang-types.
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model ietf-netconf-monitoring.
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model ietf-netconf-notifications.
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model nc-notifications.
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model notifications.
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model libnetconf-notifications.
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model ietf-netconf-with-defaults.
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model ietf-netconf-acm.
netopeer-server[3465]: ncds_set_validation: Relax NG validator set (//var/lib/libnetconf//ietf-netconf-acm-config.rng)
netopeer-server[3465]: ncds_set_validation: Schematron validator set (//var/lib/libnetconf//ietf-netconf-acm-schematron.xsl)
netopeer-server[3465]: Datastore ietf-netconf-acm initiated with ID 9.
netopeer-server[3465]: Checking the default Events stream path //var/lib/libnetconf//streams/.
netopeer-server[3465]: Adding augment model "/usr/local/etc/netopeer/cfgnetopeer/ietf-x509-cert-to-name.yin"
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model ietf-x509-cert-to-name.
netopeer-server[3465]: Adding static transapi "/usr/local/etc/netopeer/cfgnetopeer/ietf-netconf-server.yin"
netopeer-server[3465]: ncds_new_internal: Relax NG validator set (/usr/local/etc/netopeer/cfgnetopeer/ietf-netconf-server-config.rng)
netopeer-server[3465]: ncds_new_internal: Schematron validator set (/usr/local/etc/netopeer/cfgnetopeer/ietf-netconf-server-schematron.xsl)
netopeer-server[3465]: "ssh" features in "ietf-netconf-server" module enabled.
netopeer-server[3465]: "inbound-ssh" features in "ietf-netconf-server" module enabled.
netopeer-server[3465]: "outbound-ssh" features in "ietf-netconf-server" module enabled.
netopeer-server[3465]: Datastore ietf-netconf-server initiated with ID 53100989.
netopeer-server[3465]: Setting the default SSH configuration for the ietf-netconf-server module...
netopeer-server[3465]: callback_srv_netconf_srv_listen_srv_port: SSH listening on the port 830
netopeer-server[3465]: Adding static transapi "/usr/local/etc/netopeer/cfgnetopeer/netopeer-cfgnetopeer.yin"
netopeer-server[3465]: ncds_new_internal: Relax NG validator set (/usr/local/etc/netopeer/cfgnetopeer/netopeer-cfgnetopeer-config.rng)
netopeer-server[3465]: ncds_new_internal: Schematron validator set (/usr/local/etc/netopeer/cfgnetopeer/netopeer-cfgnetopeer-schematron.xsl)
netopeer-server[3465]: "dynamic-modules" features in "netopeer-cfgnetopeer" module enabled.
netopeer-server[3465]: "ssh" features in "netopeer-cfgnetopeer" module enabled.
netopeer-server[3465]: Datastore netopeer-cfgnetopeer initiated with ID 156064784.
netopeer-server[3465]: Setting the default configuration for the cfgnetopeer module...
netopeer-server[3465]: Setting the default configuration for the cfgnetopeer module SSH...
netopeer-server[3465]: Transapi calling callback /A:netopeer/A:modules/A:module/A:enabled with op ADD.
netopeer-server[3465]: Adding transapi "/usr/local/etc/netopeer/turing-machine/turing-machine.yin"
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model turing-machine.
netopeer-server[3465]: ncds_new_internal: Relax NG validator set (/usr/local/etc/netopeer/turing-machine/turing-machine-config.rng)
netopeer-server[3465]: ncds_new_internal: Schematron validator set (/usr/local/etc/netopeer/turing-machine/turing-machine-schematron.xsl)
netopeer-server[3465]: Datastore turing-machine initiated with ID 2003741139.
netopeer-server[3465]: Transapi calling callback /A:netopeer/A:modules/A:module/A:enabled with op ADD.
netopeer-server[3465]: Adding augment model "/usr/local/etc/netopeer/ietf-interfaces/iana-if-type.yin"
netopeer-server[3465]: ncds_features_parse: no feature definitions found in data model iana-if-type.
netopeer-server[3465]: Adding transapi "/usr/local/etc/netopeer/ietf-interfaces/ietf-interfaces.yin"
netopeer-server[3465]: ncds_new_internal: Relax NG validator set (/usr/local/etc/netopeer/ietf-interfaces/ietf-interfaces-config.rng)
netopeer-server[3465]: ncds_new_internal: Schematron validator set (/usr/local/etc/netopeer/ietf-interfaces/ietf-interfaces-schematron.xsl)
netopeer-server[3465]: Adding augment model "/usr/local/etc/netopeer/ietf-interfaces/ietf-ip.yin"
netopeer-server[3465]: "ipv4-non-contiguous-netmasks" features in "ietf-ip" module enabled.
netopeer-server[3465]: "ipv6-privacy-autoconf" features in "ietf-ip" module enabled.
netopeer-server[3465]: Datastore ietf-interfaces initiated with ID 563311160.
netopeer-server[3465]: Model "ietf-interfaces" transAPI: nothing changed.
netopeer-server[3465]: Starting FMON thread for ietf-interfaces data model.
netopeer-server[3465]: Unable to monitor "/etc/sysconfig/network-scripts/ifcfg-ofc-bridge" (No such file or directory)
netopeer-server[3465]: Unable to monitor "/etc/sysconfig/network-scripts/ifcfg-ovs-system" (No such file or directory)
netopeer-server[3465]: Netopeer server successfully initialized.
netopeer-server[3465]: sock_listen: could not bind "::0" port 830 (Address already in use)
netopeer-server[3465]: Server is not listening on any address!
从最后三行打印可以看到,netopeer-server启动成功,并提示端口830被占用,该端口其实是被of-config server占用了,说明netopeer-server和ofc-server监听的端口相同,两者只能有其一起作用。
启动netopeer-cli
通过netopeer-cli与netopeer-server或ofc-server建立连接:
[admin@localhost of-config]$ netopeer-cli
netconf> connect --port 830 --login root localhost
admin@localhost password:
netconf>
密码为客户机密码。
可以通过get-config running查看设备配置
netconf> get-config running
Result:
<capable-switch xmlns="urn:onf:config:yang">
<id>openvswitch</id>
<resources>
<port>
<name>eth1</name>
<requested-number>100</requested-number>
<configuration>
<admin-state>up</admin-state>
<no-receive>false</no-receive>
<no-forward>false</no-forward>
<no-packet-in>false</no-packet-in>
</configuration>
</port>
<port>
<name>ofc-bridge</name>
<requested-number>666</requested-number>
<configuration>
<admin-state>down</admin-state>
<no-receive>false</no-receive>
<no-forward>false</no-forward>
<no-packet-in>false</no-packet-in>
</configuration>
</port>
</resources>
<logical-switches>
<switch>
<id>ofc-bridge</id>
<datapath-id>00:01:02:03:04:05:06:07</datapath-id>
<lost-connection-behavior>failSecureMode</lost-connection-behavior>
<resources>
<port>eth1</port>
<port>ofc-bridge</port>
</resources>
</switch>
</logical-switches>
</capable-switch>
可以看到输出的信息是ovs虚拟交换机的信息,说明of-config主要管理的是ovs虚拟交换机。
可以通过edit-config配置设备,如删除ovs上的端口eth1
netconf> edit-config --config=remove_port_eth1.xml running
Result OK
通过get-config再次查看配置信息
netconf> get-config running
Result:
<capable-switch xmlns="urn:onf:config:yang">
<id>openvswitch</id>
<resources>
<port>
<name>ofc-bridge</name>
<requested-number>666</requested-number>
<configuration>
<admin-state>down</admin-state>
<no-receive>false</no-receive>
<no-forward>false</no-forward>
<no-packet-in>false</no-packet-in>
</configuration>
</port>
</resources>
<logical-switches>
<switch>
<id>ofc-bridge</id>
<datapath-id>00:01:02:03:04:05:06:07</datapath-id>
<lost-connection-behavior>failSecureMode</lost-connection-behavior>
<resources>
<port>ofc-bridge</port>
</resources>
</switch>
</logical-switches>
</capable-switch>
可以看到eth1被成功删除,可以通过ovs命令直接验证操作结果:
[root@localhost of-config]# ovs-vsctl show
917d5bcc-81f0-43e3-8fce-d1eebbd99b21
Bridge ofc-bridge
fail_mode: secure
Port ofc-bridge
Interface ofc-bridge
type: internal
端口eth1被正确删除。
下面将ofc-server关闭,重启netopeer-server服务,看一下netopeer-server对linux设备的管理。
通过ifconfig查看设备当前配置:
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:10:34:46
inet addr:192.168.111.11 Bcast:192.168.111.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe10:3446/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:92 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9329 (9.1 KiB) TX bytes:258 (258.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:238 errors:0 dropped:0 overruns:0 frame:0
TX packets:238 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:44900 (43.8 KiB) TX bytes:44900 (43.8 KiB)
通过netopeer-cli连接netopeer-server服务,通过get-config running命令查看当前配置:
netconf> get-config running
Result:
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>lo</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:softwareLoopback</type>
<enabled>true</enabled>
<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>16436</mtu>
<address>
<ip>127.0.0.1</ip>
<prefix-length>8</prefix-length>
</address>
</ipv4>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>16436</mtu>
<dup-addr-detect-transmits>1</dup-addr-detect-transmits>
<autoconf>
<create-global-addresses>true</create-global-addresses>
<create-temporary-addresses>true</create-temporary-addresses>
<temporary-valid-lifetime>604800</temporary-valid-lifetime>
<temporary-preferred-lifetime>86400</temporary-preferred-lifetime>
</autoconf>
</ipv6>
</interface>
<interface>
<name>eth0</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
<enabled>false</enabled>
<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>false</enabled>
<forwarding>false</forwarding>
<mtu>1500</mtu>
</ipv4>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>1500</mtu>
<dup-addr-detect-transmits>1</dup-addr-detect-transmits>
<autoconf>
<create-global-addresses>true</create-global-addresses>
<create-temporary-addresses>true</create-temporary-addresses>
<temporary-valid-lifetime>604800</temporary-valid-lifetime>
<temporary-preferred-lifetime>86400</temporary-preferred-lifetime>
</autoconf>
</ipv6>
</interface>
</interfaces>
通过edit-config命令对设备进行如下配置:
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>eth0</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
<enabled>true</enabled>
<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>1500</mtu>
<address>
<ip>10.10.10.1</ip>
<prefix-length>24</prefix-length>
</address>
</ipv4>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>1500</mtu>
<dup-addr-detect-transmits>1</dup-addr-detect-transmits>
<autoconf>
<create-global-addresses>true</create-global-addresses>
<create-temporary-addresses>true</create-temporary-addresses>
<temporary-valid-lifetime>604800</temporary-valid-lifetime>
<temporary-preferred-lifetime>86400</temporary-preferred-lifetime>
</autoconf>
</ipv6>
</interface>
</interfaces>
通过get-config命令再次查看配置信息:
netconf> get-config running
Result:
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>lo</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:softwareLoopback</type>
<enabled>true</enabled>
<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>16436</mtu>
<address>
<ip>127.0.0.1</ip>
<prefix-length>8</prefix-length>
</address>
</ipv4>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>16436</mtu>
<dup-addr-detect-transmits>1</dup-addr-detect-transmits>
<autoconf>
<create-global-addresses>true</create-global-addresses>
<create-temporary-addresses>true</create-temporary-addresses>
<temporary-valid-lifetime>604800</temporary-valid-lifetime>
<temporary-preferred-lifetime>86400</temporary-preferred-lifetime>
</autoconf>
</ipv6>
</interface>
<interface>
<name>eth0</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
<enabled>true</enabled>
<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>1500</mtu>
<address>
<ip>10.10.10.1</ip>
<prefix-length>24</prefix-length>
</address>
</ipv4>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<enabled>true</enabled>
<forwarding>false</forwarding>
<mtu>1500</mtu>
<dup-addr-detect-transmits>1</dup-addr-detect-transmits>
<autoconf>
<create-global-addresses>true</create-global-addresses>
<create-temporary-addresses>true</create-temporary-addresses>
<temporary-valid-lifetime>604800</temporary-valid-lifetime>
<temporary-preferred-lifetime>86400</temporary-preferred-lifetime>
</autoconf>
</ipv6>
</interface>
</interfaces><netopeer xmlns="urn:cesnet:tmc:netopeer:1.0">
<modules>
<module>
<name>turing-machine</name>
<enabled>true</enabled>
</module>
<module>
<name>ietf-interfaces</name>
<enabled>true</enabled>
</module>
</modules>
</netopeer>
可以看到端口eth0配置成功,通过ifconfig命令可以验证配置成功
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:10:34:46
inet addr:10.10.10.1 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe10:3446/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:93 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9572 (9.3 KiB) TX bytes:258 (258.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:323 errors:0 dropped:0 overruns:0 frame:0
TX packets:323 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:66730 (65.1 KiB) TX bytes:66730 (65.1 KiB)
of-config启动流程总结
- 启动OVS
- 启动ofc-server
- 使用任意NETCONF客户端(例如netopeer-cli)连接ofc-server(NETCONF默认端口830/TCP)。
*【netopeer-server不必启动,netopeer-server主要对设备进行管理 ,of-config主要对运行在设备里的ovs进行管理】
完毕!