Configuring GRE


PicOS OVS supports IP GRE tunneling.

The port ranges in PicOS are as follows:

Port TypePort Number

GRE

3073-4095


GRE ON Physical PORT

Creating a GRE tunnel

root@PicOS-OVS# ovs-vsctl add-port br0 gre1 -- set Interface gre1 type=pica8_gre options:remote_ip=10.10.60.10 options:local_ip=10.10.61.10 options:vlan=1 options:src_mac=00:11:11:11:11:11 options:dst_mac=00:22:22:22:22:22 options:egress_port=ge-1/1/5 

If the user wants to create a GRE tunnel, the user will need to configure a GRE tunnel along with two flows, which are used for sending traffic to the GRE and sending output from the GRE respectively.

root@PicOS-OVS# ovs-ofctl add-flow br0 in_port=1,actions=output:3073
root@PicOS-OVS# ovs-ofctl add-flow br0 in_port=3073,actions=mod_dl_src:00:11:11:11:11:11,mod_dl_dst:00:33:33:33:33:33,output:1 


The GRE port number starts from 3073, which is the port number of GRE1. The first flow in the example above, is configured so that all traffic from port ge-1/1/1 will be sent to the GRE tunnel, whose port number is 3073. The second flow is configured so that all of the traffic coming out from the GRE tunnel will be forwarded to port ge-1/1/1 and the source MAC address modified to the switch's MAC address and the destination MAC address to the MAC address of the internal target. (If user doesn't specify the dl_src in the action of second flow, the src mac will be the switch's mac, but the dst mac must be specified.)

Description

 

  1. br0: bridge name
  2. remote_ip=10.10.60.10: the IP address of the peer GRE tunnel interface; this IP address will be the destination IP of the encapsulated GRE packets
  3. local_ip=10.10.61.10: the IP address of this GRE tunnel interface; this IP address will be the source IP of the encapsulated GRE packets
  4. src_mac=00:11:11:11:11:11: the logical MAC address of the GRE tunnel interface; this MAC address will be the source MAC of the encapsulated GRE packets to next-hop
  5. dst_mac=00:22:22:22:22:22: the next-hop MAC address; this MAC address will be the destination MAC the encapsulated GRE packets to next-hop
  6. egress_port=ge-1/1/5: the output port of the encapsulated GRE packets

GRE ON LAG/LACP PORT

Static Lag and GRE Tunnel

Command:

admin@PicOS-OVS$ovs-vsctl add-port br0 ae1 vlan_mode=trunk tag=1 -- set interface ae1 type=pica8_lag options:members=te-1/1/78,te-1/1/80
admin@PicOS-OVS$ovs-vsctl -- set interface ae1 options:lag_type=static
admin@PicOS-OVS$ovs-vsctl add-port br0 gre1 -- set Interface gre1 type=pica8_gre options:local_ip=10.10.60.10 options:remote_ip=10.10.61.10 options:vlan=1012 options:dst_mac=C8:0A:A9:9E:14:A5 options:src_mac=C8:0A:A9:04:49:1A options:egress_port=ae1

 Flows:

root@PicOS-OVS# ovs-ofctl add-flow br0 in_port=1,actions=output:3073
root@PicOS-OVS# ovs-ofctl add-flow br0 in_port=3073,actions=mod_dl_src:00:11:11:11:11:11,mod_dl_dst:00:33:33:33:33:33,output:1 

LACP and GRE Tunnel

Command:

admin@PicOS-OVS$ovs-vsctl add-port br0 ae1 vlan_mode=trunk tag=1 -- set interface ae1 type=pica8_lag options:members=te-1/1/78,te-1/1/80
admin@PicOS-OVS$ovs-vsctl -- set interface ae1 options:lag_type=lacp
admin@PicOS-OVS$ovs-vsctl add-port br0 gre1 -- set Interface gre1 type=pica8_gre options:local_ip=10.10.60.10 options:remote_ip=10.10.61.10 options:vlan=1012 options:dst_mac=C8:0A:A9:9E:14:A5 options:src_mac=C8:0A:A9:04:49:1A options:egress_port=ae1

Flows:

root@PicOS-OVS# ovs-ofctl add-flow br0 in_port=1,actions=output:3073
root@PicOS-OVS# ovs-ofctl add-flow br0 in_port=3073,actions=mod_dl_src:00:11:11:11:11:11,mod_dl_dst:00:33:33:33:33:33,output:1 


Example

                                  +--------------+       +--------------+

             ixia(11/1) — |22  sw1   23|-----|23  sw2       |22--------ixia(11/2)

                                  |                25|-----|25               |

                                 +------|---------+     +---------------+

                                                |24

                                       IXIA(11/3)

SW1 CONFIG:

Step1: Create a bridge and add two ports (PX1,PX2,PX3)


ovs-vsctl add-br br0 -- set bridge br0 datapath_type=pica8
ovs-vsctl add-port br0 ge-1/1/22 vlan_mode=trunk tag=1 -- set interface ge-1/1/22 type=pica8
ovs-vsctl add-port br0 ge-1/1/23 vlan_mode=trunk tag=1 -- set interface ge-1/1/23 type=pica8
ovs-vsctl add-port br0 ge-1/1/25 vlan_mode=trunk tag=1 -- set interface ge-1/1/25 type=pica8

Step 2:  Add static lag port and gre port

ovs-vsctl add-port br0 ae1 vlan_mode=trunk tag=1 -- set interface ae1 type=pica8_lag options:members=ge-1/1/23,ge-1/1/25
ovs-vsctl -- set interface ae1 options:lag_type=static
ovs-vsctl add-port br0 gre1 -- set Interface gre1 type=pica8_gre options:local_ip=10.10.60.10 options:remote_ip=10.10.61.10 options:vlan=1012 options:dst_mac=C8:0A:A9:9E:14:A5 options:src_mac=C8:0A:A9:04:49:1A options:egress_port=ae1


Step 3:  Add flow


ovs-ofctl add-flow br0 in_port=22,actions=output:3073
ovs-ofctl add-flow br0 in_port=3073,actions=set_field:66:66:66:44:44:44-\>dl_dst,set_field:66:66:66:33:33:33-\>dl_src,output:22

SW2 CONFIG:

Step1: Create a bridge and add two ports (PX1,PX2,PX3)


ovs-vsctl add-br br0 -- set bridge br0 datapath_type=pica8
ovs-vsctl add-port br0 ge-1/1/22 vlan_mode=trunk tag=1 -- set interface ge-1/1/22 type=pica8
ovs-vsctl add-port br0 ge-1/1/23 vlan_mode=trunk tag=1 -- set interface ge-1/1/23 type=pica8
ovs-vsctl add-port br0 ge-1/1/25 vlan_mode=trunk tag=1 -- set interface ge-1/1/25 type=pica8

Step 2:  Add flow

ovs-ofctl add-flow br0 in_port=23,actions=output:22
ovs-ofctl add-flow br0 in_port=25,actions=output:22


SEND Packets

Step 4:  Send ipv4 packets,check the result(limitation:the src mac and vlan of the packets must be the same with gre tunnel)

(1) send no changing packets to PX1,

Result:

then PX2 or PX3 will transmit all the encapsulated packets

check nw_dst=10.10.61.10,nw_src= 10.10.60.10,vlan=1012,src_mac=C8:0A:A9:04:49:1A ,dst_mac=C8:0A:A9:9E:14:A5

Check:

dst mac: C8 0A A9 9E 14 A5

src mac: C8 0A A9 04 49 1A

offset:12

vlan: 81 00 03F4

dst ip: 0A 0A 3D 0A

src ip: 0A 0A 3C 0A

 

(2) sending increasing src ip to PX1,(first enable hash mapping mode:ovs-vsctl -- set Interface ae1 options:hash-mapping=advance ovs-vsctl set-lag-advance-hash-mapping-fields  nw_src)

Result:


then both PX2 and PX3 will transmit the encapsulated packets
check nw_dst=10.10.61.10,nw_src= 10.10.60.10,vlan=1012,src_mac=C8:0A:A9:04:49:1A ,dst_mac=C8:0A:A9:9E:14:A5


Then reconfigure sw2

Step1: Add static lag port and gre port

ovs-vsctl add-port br0 ae1 vlan_mode=trunk tag=1 -- set interface ae1 type=pica8_lag options:members=ge-1/1/23,ge-1/1/25
ovs-vsctl -- set interface ae1 options:lag_type=static
ovs-vsctl add-port br0 gre1 -- set Interface gre1 type=pica8_gre options:remote_ip=10.10.60.10 options:local_ip=10.10.61.10 options:vlan=1012 options:src_mac=C8:0A:A9:9E:14:A5
options:dst_mac=C8:0A:A9:04:49:1A options:egress_port=ae1


Step 2:  Add flow

ovs-ofctl add-flow br0 in_port=22,actions=output:3073
ovs-ofctl add-flow br0 in_port=3073,actions=set_field:66:66:66:44:44:44-\>dl_dst,set_field:66:66:66:33:33:33-\>dl_src,output:22

SEND Packets

(1) sending no changing packets to ge-1/1/22(SW1),

Result:

ge-1/1/22(SW2) will transmit the decapsulated packets.

check dl_src=66:66:66:33:33:33,dl_dst=66:66:66:44:44:44,vlan 1012




Copyright © 2024 Pica8 Inc. All Rights Reserved.