Last active
December 29, 2023 07:02
-
-
Save marciolm/9f0ab13b877372d08e8f to your computer and use it in GitHub Desktop.
Config Files for OpenVSwitch OpenWRT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config defaults | |
option syn_flood 1 | |
option input ACCEPT | |
option output ACCEPT | |
option forward ACCEPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config switch | |
option reset '1' | |
option enable_vlan '1' | |
option enable_learning '0' | |
option name 'switch0' | |
config switch_vlan | |
option vlan '1' | |
option ports '1 5t' | |
option device 'switch0' | |
config switch_vlan | |
option vlan '2' | |
option ports '2 5t' | |
option device 'switch0' | |
config switch_vlan | |
option vlan '3' | |
option ports '3 5t' | |
option device 'switch0' | |
config switch_vlan | |
option vlan '4' | |
option ports '4 5t' | |
option device 'switch0' | |
config switch_vlan | |
option vlan '5' | |
option ports '0 5t' | |
option device 'switch0' | |
config interface 'loopback' | |
option ifname 'lo' | |
option proto 'static' | |
option ipaddr '127.0.0.1' | |
option netmask '255.0.0.0' | |
config interface | |
option ifname 'eth0.1' | |
option proto 'static' | |
config interface | |
option ifname 'eth0.2' | |
option proto 'static' | |
config interface | |
option ifname 'eth0.3' | |
option proto 'static' | |
config interface | |
option ifname 'eth0.4' | |
option proto 'static' | |
config interface 'wan' | |
option ifname 'eth0.5' | |
option proto 'static' | |
option ipaddr '192.168.1.112' | |
option netmask '255.255.255.0' | |
option type 'bridge' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Setup variables | |
#My IP address is required for the ovsdb server. | |
MYIP=192.168.1.112 | |
# This is the OpenFlow controller ID which we're going to load into the OVS | |
CTLIP=192.168.1.130 | |
# This is our DataPath ID | |
DPID=0000000000000112 | |
# This is the name of the bridge that we're going to be creating | |
SW=br0 | |
#What ports are we going to put in the OVS? | |
DPPORTS="eth0.1 eth0.2 eth0.3 eth0.4 wlan0 wlan0-2 wlan0-3" | |
#DPPORTS="eth0.1 eth0.2 eth0.3 eth0.4" | |
#Alias some variables | |
VSCTL="ovs-vsctl --db=tcp:$MYIP:9999" | |
OVSDB=/tmp/ovs-vswitchd.conf.db | |
# Subroutine to wait until a port is ready | |
wait_port_listen() { | |
port=$1 | |
while ! `netstat -na | grep $port` ; do | |
echo -n . | |
sleep 1 | |
done | |
} | |
# Kill off the servers and remove any stale lockfiles | |
/usr/bin/killall ovsdb-server | |
/usr/bin/killall ovs-vswitchd | |
rm /tmp/.ovs-vswitchd.conf.db.~lock~ | |
# Remove the OVS Database and then recreate. | |
rm -f $OVSDB | |
ovsdb-tool create $OVSDB /usr/share/openvswitch/vswitch.ovsschema | |
# Start the OVSDB server and wait until it starts | |
ovsdb-server $OVSDB --remote=ptcp:9999:$MYIP & | |
#wait_port_listen 9999 | |
sleep 5 | |
# Start vSwitchd | |
ovs-vswitchd tcp:$MYIP:9999 --pidfile=ovs-vswitchd.pid --overwrite-pidfile -- & | |
# Create the bridge and pass in some configuration options | |
$VSCTL add-br $SW | |
$VSCTL set bridge $SW protocols=OpenFlow10 | |
#Cycle through the DataPath ports adding them to the switch | |
for i in $DPPORTS ; do | |
PORT=$i | |
ifconfig $PORT up | |
$VSCTL add-port $SW $PORT | |
done | |
#Ensure that the switch has the correct DataPath ID | |
$VSCTL set bridge $SW other-config:datapath-id=$DPID | |
#Configure the switch to have an OpenFlow Controller. This will contact the controller. | |
$VSCTL set-controller $SW tcp:$CTLIP:6633 | |
# Turn off the fail-safe mode | |
$VSCTL set-fail-mode br0 secure | |
# | |
# | |
$VSCTL --db=tcp:$MYIP:9999 --id=@sflow create sflow agent=eth0 target=\"$CTLIP:6343\" sampling=2 polling=20 -- -- set bridge $SW sflow=@sflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config wifi-device radio0 | |
option type mac80211 | |
option channel 11 | |
option hwmode 11ng | |
option path 'platform/ath9k' | |
option htmode HT20 | |
list ht_capab SHORT-GI-40 | |
list ht_capab DSSS_CCK-40 | |
# REMOVE THIS LINE TO ENABLE WIFI: | |
#option disabled 1 | |
config wifi-iface wlan0 | |
option device radio0 | |
# option network lan | |
option mode ap | |
option ssid OpenFlow-112-lan | |
option encryption none | |
config wifi-iface wlan1 | |
option device radio0 | |
option network wan | |
option mode mesh | |
option mesh_id 1 | |
option ssid OF-CP-mesh-1 | |
option encryption none | |
config wifi-iface wlan2 | |
option device radio0 | |
# option network lan | |
option mode mesh | |
option mesh_id 2 | |
option ssid OF-DP-mesh-2 | |
option encryption none | |
config wifi-iface wlan3 | |
option device radio0 | |
# option network lan | |
option mode mesh | |
option mesh_id 3 | |
option ssid OF-DP-mesh-3 | |
option encryption none | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment