version 0.5.2

add lxd
This commit is contained in:
garywill 2018-08-31 18:41:06 +08:00 committed by garywill
parent 749b82a137
commit 258181055c
3 changed files with 66 additions and 15 deletions

19
NOTICE
View File

@ -21,3 +21,22 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================
linux-router
Copyright (C) 2018 garywill
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

View File

@ -89,25 +89,57 @@ In `torrc`
TransPort 0.0.0.0:9040
DNSPort 0.0.0.0:9053
```
### Use with LXC
### Use for LXC
Create a bridge
```
# brctl addbr lxcbr1
# brctl addbr lxcbr5
```
In LXC container `config`
```
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr1
lxc.network.link = lxcbr5
lxc.network.hwaddr = xx:xx:xx:xx:xx:xx
```
```
# lnxrouter -i lxcbr1
# lnxrouter -i lxcbr5
```
### Use with VirtualBox
On VirtualBox's global settings, create a host-only network `vboxnet1` with DHCP disabled.
### Use as transparent proxy for LXD
Create a bridge
```
# lnxrouter -i vboxnet1
# brctl addbr lxdbr5
```
Create and add LXD profile
```
$ lxc profile create profile5
$ lxc profile edit profile5
### profile content ###
config: {}
description: ""
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr5
type: nic
name: profile5
$ lxc profile add <container> profile5
```
That should make one container have 2 profiles. `profile5` will override `eth0`.
```
# lnxrouter -i lxdbr5 --tp 9040 --dns-proxy 9053
```
To remove that new profile from container
```
$ lxc profile remove <container> profile5
```
### Use as transparent proxy for VirtualBox
On VirtualBox's global settings, create a host-only network `vboxnet5` with DHCP disabled.
```
# lnxrouter -i vboxnet5 --tp 9040 --dns-proxy 9053
```
### CLI usage and other features

View File

@ -1,6 +1,6 @@
#!/bin/bash
VERSION=0.5.1
VERSION=0.5.2
PROGNAME="$(basename $0)"
export LC_ALL=C
@ -944,13 +944,13 @@ if [[ $SHARE_METHOD == 'none' ]]; then
fi
if [[ -d /dev/shm ]]; then
TMPDIR=/dev/shm
TMPD=/dev/shm
elif [[ -d /run/shm ]]; then
TMPDIR=/run/shm
TMPD=/run/shm
else
TMPDIR=/tmp
TMPD=/tmp
fi
TMPDIR=$TMPDIR/lnxrouter_tmp
TMPDIR=$TMPD/lnxrouter_tmp
#======
@ -1251,7 +1251,7 @@ wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
EOF
else
echo "Warning: Wifi is not protected by password" >&2
echo "WARN: Wifi is not protected by password" >&2
fi
chmod 600 $CONFDIR/hostapd.conf
fi
@ -1331,7 +1331,7 @@ elif [[ "$SHARE_METHOD" == "nat" ]]; then
elif [[ "$SHARE_METHOD" == "redsocks" ]]; then
if [[ "$dnsmasq_NO_DNS" -eq 0 ]]; then
echo
echo "Warning: You are using transparent proxy but gateway is providing local DNS, this may cause privacy leak !!!"
echo "WARN: You are using transparent proxy but gateway is providing local DNS, this may cause privacy leak !!!" >&2
echo
fi
start_redsocks
@ -1409,7 +1409,7 @@ fi
sleep 2
# need loop to keep this script running
bash -c "while :; do sleep 3 ; done " &
bash -c "while :; do sleep 800 ; done " &
KEEP_RUNNING_PID=$!
echo $KEEP_RUNNING_PID > $CONFDIR/keep_running.pid
wait $KEEP_RUNNING_PID