123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?xml version="1.0" encoding="UTF-8"?>
- <CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
- http://clish.sourceforge.net/XMLSchema/clish.xsd">
- <!--=======================================================-->
- <VIEW name="enable-view">
- <!-- Show routing information -->
- <COMMAND name="show ip route"
- help="IP routing table"
- lock="false"
- interrupt="true">
- <ACTION>ip route show</ACTION>
- </COMMAND>
- </VIEW>
- <VIEW name="configure-view">
- <!-- Enable/Disable routing -->
- <COMMAND name="ip routing"
- help="Enable IP routing">
- <CONFIG operation="unset" pattern="^no ip routing"/>
- <ACTION>
- echo "1" > /proc/sys/net/ipv4/ip_forward
- </ACTION>
- </COMMAND>
- <COMMAND name="no ip routing"
- help="Disable IP routing">
- <CONFIG priority="0x1500"/>
- <ACTION>
- echo "0" > /proc/sys/net/ipv4/ip_forward
- </ACTION>
- </COMMAND>
- <!-- Default gateway -->
- <COMMAND name="ip default-gateway"
- help="Specify default gateway (if not routing IP)">
- <PARAM name="ip"
- help="IP address of default gateway"
- ptype="IP_ADDR"/>
- <CONFIG priority="0x9000" splitter="false"/>
- <ACTION>
- ip route replace to default via ${ip}
- </ACTION>
- </COMMAND>
- <COMMAND name="no ip default-gateway"
- help="Specify default gateway (if not routing IP)">
- <CONFIG operation="unset" pattern="^ip default-gateway"/>
- <ACTION>
- ip route delete to default
- </ACTION>
- </COMMAND>
- <!-- Set/Unset static route -->
- <COMMAND name="ip route"
- help="Establish static routes">
- <PARAM name="ip"
- help="Destination prefix"
- ptype="IP_ADDR_MASK"/>
- <PARAM name="route_target"
- help="Route target"
- ptype="STRING"
- mode="switch">
- <PARAM name="ethernet"
- help="Ethernet IEEE 802.3"
- ptype="SUBCOMMAND"
- mode="subcommand">
- <PARAM name="iface_num"
- help="Ethernet interface number"
- ptype="IFACE_NUM"/>
- </PARAM>
- <PARAM name="forward"
- help="Forwarding router's address"
- ptype="IP_ADDR"/>
- </PARAM>
- <CONFIG priority="0x9002" pattern="^ip route ${ip} " splitter="false"/>
- <ACTION>
- if test "${route_target}" = "ethernet"; then
- ip route replace to ${ip} dev eth${iface_num}
- exit $?
- elif test "${route_target}" = "forward"; then
- ip route replace to ${ip} via ${forward}
- exit $?
- fi
- </ACTION>
- </COMMAND>
- <COMMAND name="no ip route"
- help="Establish static routes">
- <PARAM name="ip"
- help="Destination prefix"
- ptype="IP_ADDR_MASK"/>
- <CONFIG operation="unset" pattern="^ip route ${ip} "/>
- <ACTION>
- ip route delete to ${ip}
- </ACTION>
- </COMMAND>
- </VIEW>
- </CLISH_MODULE>
|