Skip to content

Instantly share code, notes, and snippets.

@sandman
Forked from TalalMash/[OpenWRT] UBOND Example
Created April 25, 2023 10:08
Show Gist options
  • Save sandman/fcadd4620addf66c56706743aa224cc6 to your computer and use it in GitHub Desktop.
Save sandman/fcadd4620addf66c56706743aa224cc6 to your computer and use it in GitHub Desktop.
[OpenWRT] UBOND Example
Download binaries: https://github.com/TalalMash/ubond/releases/tag/v0.1.1
Disable encryption for 400Mbit+ , force DNS over HTTPS if needed.
Temporarily running as root. (tun bugfix TODO)
----------------------
VPS/crontab -e:
@reboot screen -d -m sh -c "/root/startubond.sh"
----------------------
/root/startubond.sh
----------------------
#!/bin/sh
/root/ubond -c /root/ubond.conf --yes-run-as-root -u root &
sleep 2
/usr/sbin/ifconfig ubond0 up
/usr/sbin/ifconfig ubond0 10.66.66.1 pointopoint 10.66.66.2
/usr/sbin/ifconfig ubond0 mtu 1340
/usr/sbin/iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
----------------------
/root/ubond.conf
----------------------
[general]
mode = "server"
tuntap = "tun"
# Sets the tunnel interface name (LINUX only)
interface_name = "ubond0"
# After "timeout" seconds of inactivity, the link will be considered
# dead and will be disconnected.
timeout = 30
password = "3tgskfoie3jnfv894"
# if cleartext_data is set to 1, then session data (auth)
# will still be encrypted, but all data packets will NOT.
# use this setting only when you can't do otherwise (for performance reasons).
cleartext_data = 1
reorder_buffer_size = 64
#[filters]
#dsl1 = ip proto icmp
#airlink = ip proto icmp
[ISP1]
bindhost = "0.0.0.0"
bindport = 65530
bandwidth_upload = 80000 #Speed in kbit, set to average speed -20% for faster weighing
[ISP2]
bindhost = "0.0.0.0"
bindport = 65531
bandwidth_upload = 11000
----------------------
chmod 600 config
------------------------------------------------------------------
Openwrt /etc/ubond.conf
----------------------
[general]
mode = "client"
tuntap = "tun"
interface_name = "ubond0"
timeout = 30
password = "3tgskfoie3jnfv894"
# if cleartext_data is set to 1, then session data (auth)
# will still be encrypted, but all data packets will NOT.
# use this setting only when you can't do otherwise (for performance reasons).
cleartext_data = 1
# Remote control can be setup on UNIX socket
# and TCP / HTTP protocol.
# remote control will output statistics only at the moment.
# You can visualise statistics using the www/ templates.
# RAW json stream available on http://[control_bind_host]:[control_bind_port]/status
# Edit www/js/ubond.js url to point to your ubond status URL.
#control_unix_path = "@localstatedir@/run/ubond.sock"
control_bind_host = "0.0.0.0"
control_bind_port = "1040"
# Reordering
# reorder_buffer_size corresponds to a number of packets ubond should hold
# in case you want to enable re-ordering system.
# Don't put insane values, 64 is usually sufficient for most DSL links.
# reorder_buffer_size is 0 (disabled) by default.
reorder_buffer_size = 64
# Filtering system
# when UBOND is configured to balance traffic across multiple links
# It may be required to force some traffic (VoIP) through a specific
# interface. No reordering or load balancing will be applied on thoses
# packets.
#
# The variables inside the block will define the interface your filter
# will be routed to.
# Filters are EXCLUSIVE FIRST MATCH. That means if a packet matches
# an expression and the interface is ready to receive data,
# filtering STOPS and the packet is sent.
# Filters are pcap-filter(7). Like tcpdump. (man 7 pcap-filter)
#[filters]
#dsl1 = ip proto icmp
#airlink = ip proto icmp
[ISP1]
bindhost = "0.0.0.0"
binddev = "4G"
remotehost = "144.24.194.216"
remoteport = 65530
bandwidth_upload = 30000
[ISP2]
bindhost = "0.0.0.0"
binddev = "ADSL"
remotehost = "144.24.194.216"
remoteport = 65531
bandwidth_upload = 512
----------------------
Add to rc.local
----------------------
screen -d -m sh -c "ubond -u root -c /etc/ubond.conf"
----------------------
Set in LuCI/uci ubond0 MTU to 1340
Set IP to 10.66.66.2 GW 10.66.66.1 FW WAN/RED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment