跳转到内容
Ask AI

Static‑Route

此内容尚不支持你的语言。

This chapter provides examples on how to use Netconf to manage static routes on AsterNOS devices.

Request example to create a static route entry via edit-config.

<config><top>
<static-routes>
<static-route operation="create">
<vrf>default</vrf>
<prefix>20.0.0.1/32</prefix>
<nexthops>
<ip-ifindex-nexthops>
<gateway>200.0.0.1</gateway>
<interface>Vlan100</interface>
</ip-ifindex-nexthops>
</nexthops>
</static-route>
</static-routes>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:f0664782-0072-4b64-990b-228306437b46">
<ok/>
</rpc-reply>

Request example to get a static route entry via get-config.

<filter type="subtree">
<top>
<static-routes>
<static-route>
<vrf>default</vrf>
<prefix>20.0.0.1/32</prefix>
</static-route>
</static-routes>
</top>
</filter>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:905bb409-0fb4-4e29-8e98-0f0f815157f5">
<data>
<top>
<static-routes xmlns="http://asterfusion.com/ns/yang/asternos-static-route">
<static-route>
<vrf>default</vrf>
<prefix>20.0.0.1/32</prefix>
<nexthops>
<ip-ifindex-nexthops>
<gateway>200.0.0.1</gateway>
<interface>Vlan100</interface>
<bfd/>
</ip-ifindex-nexthops>
</nexthops>
</static-route>
</static-routes>
</top>
</data>
</rpc-reply>

Request example to modify a static route entry via edit-config.

<config><top>
<static-routes>
<static-route operation="merge">
<vrf>default</vrf>
<prefix>20.0.0.1/32</prefix>
<nexthops>
<ip-ifindex-nexthops>
<gateway>200.0.0.1</gateway>
<interface>Ethernet1</interface>
<bfd/>
</ip-ifindex-nexthops>
</nexthops>
</static-route>
</static-routes>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:f0664782-0072-4b64-990b-228306437b46">
<ok/>
</rpc-reply>

Request example to delete a static route entry via edit-config.

<top xmlns="http://www.asterfusion.com/asternos-schema/1.0/config">
<static-routes>
<static-route operation="delete">
<vrf>default</vrf>
<prefix>20.0.0.1/32</prefix>
</static-route>
</static-routes>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:f0664782-0072-4b64-990b-228306437b46">
<ok/>
</rpc-reply>

Request example to show ipv4 route via rpc show-ip-route.

<show-ip-route/>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:9fc00984-0c97-4cb8-ad66-74d2440c5802">
<data>
<prefix>0.0.0.0/0</prefix>
<prefixLen>0</prefixLen>
<protocol>kernel</protocol>
<vrfId>0</vrfId>
<vrfName>default</vrfName>
<selected>True</selected>
<destSelected>True</destSelected>
<distance>0</distance>
<metric>201</metric>
<installed>True</installed>
<table>254</table>
<internalStatus>16</internalStatus>
<internalFlags>8</internalFlags>
<internalNextHopNum>1</internalNextHopNum>
<internalNextHopActiveNum>1</internalNextHopActiveNum>
<nexthopGroupId>7</nexthopGroupId>
<installedNexthopGroupId>7</installedNexthopGroupId>
<uptime>1d09h02m</uptime>
<nexthops>
<flags>3</flags>
<fib>True</fib>
<ip>192.168.0.1</ip>
<afi>ipv4</afi>
<interfaceIndex>3</interfaceIndex>
<interfaceName>eth0</interfaceName>
<active>True</active>
<weight>1</weight>
</nexthops>
</data>
<data>
<prefix>20.0.0.1/32</prefix>
<prefixLen>32</prefixLen>
<protocol>static</protocol>
<vrfId>0</vrfId>
<vrfName>default</vrfName>
<distance>1</distance>
<metric>0</metric>
<table>254</table>
<internalStatus>2</internalStatus>
<internalFlags>65</internalFlags>
<internalNextHopNum>1</internalNextHopNum>
<internalNextHopActiveNum>0</internalNextHopActiveNum>
<nexthopGroupId>61</nexthopGroupId>
<uptime>00:07:33</uptime>
<nexthops>
<flags>0</flags>
<ip>200.0.0.1</ip>
<afi>ipv4</afi>
<interfaceIndex>62</interfaceIndex>
<interfaceName>Ethernet1</interfaceName>
<weight>1</weight>
</nexthops>
</data>
<data>
<prefix>192.168.0.0/20</prefix>
<prefixLen>20</prefixLen>
<protocol>connected</protocol>
<vrfId>0</vrfId>
<vrfName>default</vrfName>
<selected>True</selected>
<destSelected>True</destSelected>
<distance>0</distance>
<metric>0</metric>
<installed>True</installed>
<table>254</table>
<internalStatus>16</internalStatus>
<internalFlags>8</internalFlags>
<internalNextHopNum>1</internalNextHopNum>
<internalNextHopActiveNum>1</internalNextHopActiveNum>
<nexthopGroupId>5</nexthopGroupId>
<installedNexthopGroupId>5</installedNexthopGroupId>
<uptime>1d09h02m</uptime>
<nexthops>
<flags>3</flags>
<fib>True</fib>
<directlyConnected>True</directlyConnected>
<interfaceIndex>3</interfaceIndex>
<interfaceName>eth0</interfaceName>
<active>True</active>
<weight>1</weight>
</nexthops>
</data>
</rpc-reply>

Request example to create a ipv6 static route entry via edit-config.

<config><top>
<static-routes>
<static-route>
<vrf>default</vrf>
<prefix>2001:db8:1234::/64</prefix>
<nexthops>
<ip-nexthops>
<gateway>2002::1</gateway>
<nh-vrf>default</nh-vrf>
</ip-nexthops>
</nexthops>
</static-route>
</static-routes>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:f0664782-0072-4b64-990b-228306437b46">
<ok/>
</rpc-reply>

Request example to get a ipv6 static route entry via get-config with subtree filter.

<filter type="subtree">
<top>
<static-routes>
<static-route>
<vrf>default</vrf>
<prefix>2001:db8:1234::/64</prefix>
</static-route>
</static-routes>
</top>
</filter>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:1eaafdf3-f363-42b9-b3c5-0e6a817c7e47">
<data>
<top>
<static-routes xmlns="http://asterfusion.com/ns/yang/asternos-static-route">
<static-route>
<vrf>default</vrf>
<prefix>2001:db8:1234::/64</prefix>
<nexthops>
<ip-nexthops>
<nh-vrf>default</nh-vrf>
<gateway>2002::1</gateway>
<bfd/>
</ip-nexthops>
</nexthops>
</static-route>
</static-routes>
</top>
</data>
</rpc-reply>

Request example to delete a ipv6 static route entry via edit-config.

<config><top>
<static-routes>
<static-route operation="delete">
<vrf>default</vrf>
<prefix>2001:db8:1234::/64</prefix>
</static-route>
</static-routes>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:133892cb-e2d7-4af8-823c-a0b34b1d00ec">
<ok/>
</rpc-reply>

Request example to show ipv6 static route via rpc show-ipv6-router.

<show-ipv6-route/>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:e1c3c49c-c8a9-4125-b19d-f493f036e789">
<data>
<prefix>2011::/20</prefix>
<prefixLen>20</prefixLen>
<protocol>connected</protocol>
<vrfId>0</vrfId>
<vrfName>default</vrfName>
<selected>True</selected>
<destSelected>True</destSelected>
<distance>0</distance>
<metric>0</metric>
<installed>True</installed>
<table>254</table>
<internalStatus>16</internalStatus>
<internalFlags>8</internalFlags>
<internalNextHopNum>1</internalNextHopNum>
<internalNextHopActiveNum>1</internalNextHopActiveNum>
<nexthopGroupId>53</nexthopGroupId>
<installedNexthopGroupId>53</installedNexthopGroupId>
<uptime>04:31:10</uptime>
<nexthops>
<flags>3</flags>
<fib>True</fib>
<directlyConnected>True</directlyConnected>
<interfaceIndex>55</interfaceIndex>
<interfaceName>Ethernet10</interfaceName>
<active>True</active>
<weight>1</weight>
</nexthops>
</data>
<data>
<prefix>2011::/20</prefix>
<prefixLen>20</prefixLen>
<protocol>kernel</protocol>
<vrfId>0</vrfId>
<vrfName>default</vrfName>
<distance>0</distance>
<metric>256</metric>
<installed>True</installed>
<table>254</table>
<internalStatus>16</internalStatus>
<internalFlags>0</internalFlags>
<internalNextHopNum>1</internalNextHopNum>
<internalNextHopActiveNum>1</internalNextHopActiveNum>
<nexthopGroupId>53</nexthopGroupId>
<uptime>04:31:10</uptime>
<nexthops>
<flags>3</flags>
<fib>True</fib>
<directlyConnected>True</directlyConnected>
<interfaceIndex>55</interfaceIndex>
<interfaceName>Ethernet10</interfaceName>
<active>True</active>
<weight>1</weight>
</nexthops>
</data>
<data>
<prefix>3011::/20</prefix>
<prefixLen>20</prefixLen>
<protocol>connected</protocol>
<vrfId>0</vrfId>
<vrfName>default</vrfName>
<selected>True</selected>
<destSelected>True</destSelected>
<distance>0</distance>
<metric>0</metric>
<installed>True</installed>
<table>254</table>
<internalStatus>16</internalStatus>
<internalFlags>8</internalFlags>
<internalNextHopNum>1</internalNextHopNum>
<internalNextHopActiveNum>1</internalNextHopActiveNum>
<nexthopGroupId>53</nexthopGroupId>
<installedNexthopGroupId>53</installedNexthopGroupId>
<uptime>04:31:10</uptime>
<nexthops>
<flags>3</flags>
<fib>True</fib>
<directlyConnected>True</directlyConnected>
<interfaceIndex>55</interfaceIndex>
<interfaceName>Ethernet10</interfaceName>
<active>True</active>
<weight>1</weight>
</nexthops>
</data>
<data>
<prefix>3011::/20</prefix>
<prefixLen>20</prefixLen>
<protocol>kernel</protocol>
<vrfId>0</vrfId>
<vrfName>default</vrfName>
<distance>0</distance>
<metric>256</metric>
<installed>True</installed>
<table>254</table>
<internalStatus>16</internalStatus>
<internalFlags>0</internalFlags>
<internalNextHopNum>1</internalNextHopNum>
<internalNextHopActiveNum>1</internalNextHopActiveNum>
<nexthopGroupId>53</nexthopGroupId>
<uptime>04:31:10</uptime>
<nexthops>
<flags>3</flags>
<fib>True</fib>
<directlyConnected>True</directlyConnected>
<interfaceIndex>55</interfaceIndex>
<interfaceName>Ethernet10</interfaceName>
<active>True</active>
<weight>1</weight>
</nexthops>
</data>
<data>
<prefix>fe80::/64</prefix>
<prefixLen>64</prefixLen>
<protocol>connected</protocol>
<vrfId>0</vrfId>
<vrfName>default</vrfName>
<distance>0</distance>
<metric>0</metric>
<installed>True</installed>
<table>254</table>
<internalStatus>16</internalStatus>
<internalFlags>0</internalFlags>
<internalNextHopNum>1</internalNextHopNum>
<internalNextHopActiveNum>1</internalNextHopActiveNum>
<nexthopGroupId>59</nexthopGroupId>
<uptime>01:07:29</uptime>
<nexthops>
<flags>3</flags>
<fib>True</fib>
<directlyConnected>True</directlyConnected>
<interfaceIndex>70</interfaceIndex>
<interfaceName>Vlan100</interfaceName>
<active>True</active>
<weight>1</weight>
</nexthops>
</data>
</rpc-reply>

Request example to create blackhole static route entry via edit-config.

<config><top>
<static-routes>
<static-route operation="create">
<vrf>default</vrf>
<prefix>10.0.0.1/24</prefix>
<nexthops>
<blackhole-nexthop>
<bh-type>unspec</bh-type>
</blackhole-nexthop>
</nexthops>
</static-route>
</static-routes>
</top></config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:b0488783-fff9-4ba2-8c4b-1df897126dc3">
<ok/>
</rpc-reply>

Request example to get blackhole static route entry via get-config with subtree filter.

<filter type="subtree">
<top>
<static-routes>
<static-route>
<vrf>default</vrf>
<prefix>10.0.0.0/24</prefix>
</static-route>
</static-routes>
</top>
</filter>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:dce27bcf-285d-44dc-a11b-5e1525354c5f">
<data>
<top>
<static-routes xmlns="http://asterfusion.com/ns/yang/asternos-static-route">
<static-route>
<vrf>default</vrf>
<prefix>10.0.0.0/24</prefix>
<nexthops>
<blackhole-nexthop>
<bh-type>unspec</bh-type>
</blackhole-nexthop>
</nexthops>
</static-route>
</static-routes>
</top>
</data>
</rpc-reply>