Skip to content

Instantly share code, notes, and snippets.

View nhooyr's full-sized avatar

Anmol Sethi nhooyr

View GitHub Profile
default via 192.168.0.1 dev wl0 proto dhcp src 192.168.0.11 metric 1024
default via 192.168.0.1 dev wl1 proto dhcp src 192.168.0.27 metric 1024
192.168.0.0/24 dev wl0 proto kernel scope link src 192.168.0.11
192.168.0.0/24 dev wl1 proto kernel scope link src 192.168.0.27
192.168.0.1 dev wl0 proto dhcp scope link src 192.168.0.11 metric 1024
192.168.0.1 dev wl1 proto dhcp scope link src 192.168.0.27 metric 1024
192.168.25.0/24 dev wl1_ap proto kernel scope link src 192.168.25.1
192.168.30.0/24 dev eth0 proto kernel scope link src 192.168.30.1
I have two wireless cards connected to my rpi. I want to use one of them as a access point and connect to the internet at the same time (yes one of my cards supports this). The other one is connected to the internet at the same time as well. wl0 is the one that only connects to the internet. wl1 is the interface of the special card connected to the internet. wl1_ap is the ap interface for the same card. Now I want to configure it so that all normal traffic from the rpi goes through wl0 but traffic coming from wl1_ap goes through wl1. I already added multiple default routes via ip rule but it doesn't seem to work very well (stability). Is there any other way I can do this?
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:36:76:54:b8:9f", NAME="wl0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="14:cc:20:25:b0:bf", NAME="wl1", \
RUN="/usr/bin/iw dev $name interface add $name_ap type __ap", \
RUN+="/usr/bin/ip link set dev $name_ap address 90:3d:3b:b2:2f:5d", \
ENV{SYSTEMD_WANTS}+="hostapd.service"
[Unit]
Description=reverse ssh tunnel for ezekiel
Requires=network-online.target
After=network-online.target
[Service]
User=nhooyr
ExecStart=/usr/bin/autossh -M 0 -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -NTC -R 10900:localhost:18187 ezekiel
RestartSec=3
Restart=on-failure
@nhooyr
nhooyr / log
Created January 19, 2016 03:49
Jan 18 22:48:05 nepu autossh[485]: Authenticated to localhost ([127.0.0.1]:6621).
Jan 18 22:48:05 nepu autossh[485]: debug1: Remote connections from LOCALHOST:10900 forwarded to local address localhost:18187
Jan 18 22:48:05 nepu autossh[485]: debug1: setting up multiplex master socket
Jan 18 22:48:05 nepu autossh[485]: debug1: channel 0: new [/home/nhooyr/.ssh/sockets/nhooyr@localhost-6621]
Jan 18 22:48:05 nepu autossh[485]: debug1: control_persist_detach: backgrounding master process
Jan 18 22:48:05 nepu autossh[485]: debug1: forking to background
Jan 18 22:48:05 nepu autossh[485]: debug1: Entering interactive session.
Jan 18 22:48:05 nepu autossh[485]: debug1: multiplexing control connection
Jan 18 22:48:05 nepu autossh[485]: debug1: channel 1: new [mux-control]
Jan 18 22:48:05 nepu autossh[485]: debug1: Requesting forwarding of remote forward LOCALHOST:10900 -> localhost:18187
if exists("+showtabline")
function! Tabline()
let s = '%#TabLabel' . mode() . '# tabs %#TabLabelNum' . mode() . '#'
let t = tabpagenr()
for i in range(1, tabpagenr('$'))
let wn = tabpagewinnr(i)
let s .= '%' . i . 'T'
let s .= '%#TabBGNum#'
let s .= ( i == t ? '%#TabNumSel#' : '%#TabNum#')
let s .= ' '
function! ToggleHighlight()
if &hls && v:hlsearch
nohls
else
set hls
endif
endfunction
@nhooyr
nhooyr / nap
Created January 25, 2016 13:29
#!/usr/bin/python3
from __future__ import absolute_import, print_function, unicode_literals
from optparse import OptionParser, make_option
import sys
import time
import dbus
import signal
package main
import (
"fmt"
"math/rand"
"time"
)
const (
max = 100 + 1
#!/usr/bin/env python
from neovim import attach
import sys, os.path
args = sys.argv[1:]
if not args:
print "Usage: nvimt <filename> ..."
sys.exit(1)
addr = os.environ["NVIM_LISTEN_ADDRESS"]