mirror of
https://github.com/garywill/linux-router.git
synced 2025-12-30 10:48:28 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45ad35d29f | ||
|
|
a663d9052b | ||
|
|
e3941c560f | ||
|
|
7ec589b1c2 | ||
|
|
10ca7249cb | ||
|
|
a414ac035b | ||
|
|
b51a2d2349 | ||
|
|
9e1d985623 | ||
|
|
433b3b8d39 | ||
|
|
e8284c5398 | ||
|
|
c2da43250e | ||
|
|
f6995bc30c | ||
|
|
f8cbf5eded |
48
README.md
48
README.md
@@ -4,7 +4,7 @@ Set Linux as router in one command. Able to provide Internet, or create WiFi hot
|
|||||||
|
|
||||||
It wraps `iptables`, `dnsmasq` etc. stuff. Use in one command, restore in one command or by `control-c` (or even by closing terminal window).
|
It wraps `iptables`, `dnsmasq` etc. stuff. Use in one command, restore in one command or by `control-c` (or even by closing terminal window).
|
||||||
|
|
||||||
[More tools and projects 🛠️](https://garywill.github.io) | [🍻 Buy me a coffee ❤️](https://github.com/garywill/receiving/blob/master/receiving_methods.md)
|
[Linux-Router News & Developer Notes 📰](https://github.com/garywill/linux-router/issues/28) | [More tools and projects 🛠️](https://garywill.github.io) | [🍻 Buy me a coffee ❤️](https://github.com/garywill/receiving/blob/master/receiving_methods.md)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ Basic features:
|
|||||||
- Create AP on the same interface you are getting Internet (usually require same channel)
|
- Create AP on the same interface you are getting Internet (usually require same channel)
|
||||||
- Transparent proxy (redsocks)
|
- Transparent proxy (redsocks)
|
||||||
- Transparent DNS proxy (hijack port 53 packets)
|
- Transparent DNS proxy (hijack port 53 packets)
|
||||||
- Compatible with NetworkManager (automatically set interface as unmanaged)
|
- Detect NetworkManager and make sure it won't interfere (handle interface (un)managed status)
|
||||||
- You can run many instances, to create many different networks. Has instances managing feature.
|
- You can run many instances, to create many different networks. Has instances managing feature.
|
||||||
|
|
||||||
**For many other features, see below [CLI usage](#cli-usage-and-other-features)**
|
**For many other features, see below [CLI usage](#cli-usage-and-other-features)**
|
||||||
@@ -92,7 +92,7 @@ sudo lnxrouter -i eth1 -o isp5 --no-dns --dhcp-dns 1.1.1.1 -6 --dhcp-dns6 [26
|
|||||||
> In this case of usage, it's recommended to:
|
> In this case of usage, it's recommended to:
|
||||||
>
|
>
|
||||||
> 1. Stop serving local DNS
|
> 1. Stop serving local DNS
|
||||||
> 2. Tell clients which DNS to use (ISP5's DNS. Or, a safe public DNS, like above example)
|
> 2. Tell clients which DNS to use ISP5's DNS. (Or, a safe public DNS, like above example)
|
||||||
|
|
||||||
> Also, read *Notice 1*
|
> Also, read *Notice 1*
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ sudo lnxrouter -i lxcbr5
|
|||||||
|
|
||||||
### Transparent proxy
|
### Transparent proxy
|
||||||
|
|
||||||
All clients' Internet traffic go through, for example, Tor
|
All clients' Internet traffic go through, for example, Tor (notice this example is NOT an anonymity use)
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -155,6 +155,10 @@ TransPort [fd00:5:6:7::1]:9040
|
|||||||
DNSPort [fd00:5:6:7::1]:9053
|
DNSPort [fd00:5:6:7::1]:9053
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Warn**: Tor's anonymity relies on a purpose-made browser. Using Tor like this (sharing Tor's network to LAN clients) will NOT ensure anonymity.
|
||||||
|
>
|
||||||
|
> Although we use Tor as example here, Linux-router does NOT ensure nor is NOT aiming at anonymity.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### Clients-in-sandbox network
|
### Clients-in-sandbox network
|
||||||
@@ -173,7 +177,7 @@ sudo lnxrouter -i eth1 \
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
> This script comes with no warrenty. Use on your own risk
|
> Linux-router comes with no warranty. Use on your own risk
|
||||||
|
|
||||||
### Use as transparent proxy for LXD
|
### Use as transparent proxy for LXD
|
||||||
|
|
||||||
@@ -317,25 +321,27 @@ Options:
|
|||||||
-d DNS server will take into account /etc/hosts
|
-d DNS server will take into account /etc/hosts
|
||||||
-e <hosts_file> DNS server will take into account additional
|
-e <hosts_file> DNS server will take into account additional
|
||||||
hosts file
|
hosts file
|
||||||
|
--dns-nocache DNS server no cache
|
||||||
|
|
||||||
--mac <MAC> Set MAC address
|
--mac <MAC> Set MAC address
|
||||||
--random-mac Use random MAC address
|
--random-mac Use random MAC address
|
||||||
|
|
||||||
--tp <port> Transparent proxy,
|
--tp <port> Transparent proxy,
|
||||||
redirect non-LAN TCP and UDP traffic to port.
|
redirect non-LAN TCP and UDP(not tested) traffic to
|
||||||
(usually used with '--dns')
|
port. (usually used with '--dns')
|
||||||
|
|
||||||
WiFi hotspot options:
|
WiFi hotspot options:
|
||||||
--ap <wifi interface> <SSID>
|
--ap <wifi interface> <SSID>
|
||||||
Create WiFi access point
|
Create WiFi access point
|
||||||
-p, --password <password>
|
-p, --password <password>
|
||||||
WiFi password
|
WiFi password
|
||||||
--qr Show WiFi QR code in terminal
|
--qr Show WiFi QR code in terminal (need qrencode)
|
||||||
|
|
||||||
--hidden Hide access point (not broadcast SSID)
|
--hidden Hide access point (not broadcast SSID)
|
||||||
--no-virt Do not create virtual interface
|
--no-virt Do not create virtual interface
|
||||||
Using this you can't use same wlan interface
|
Using this you can't use same wlan interface
|
||||||
for both Internet and AP
|
for both Internet and AP
|
||||||
|
--virt-name <name> Set name of virtual interface
|
||||||
-c <channel> Channel number (default: 1)
|
-c <channel> Channel number (default: 1)
|
||||||
--country <code> Set two-letter country code for regularity
|
--country <code> Set two-letter country code for regularity
|
||||||
(example: US)
|
(example: US)
|
||||||
@@ -388,15 +394,25 @@ Options:
|
|||||||
|
|
||||||
## What changes are done to Linux system
|
## What changes are done to Linux system
|
||||||
|
|
||||||
On exit of a linux-router instance, script **will do cleanup**, i.e. undo most changes to system. Though, **some** changes will **not** be undone, which are:
|
On exit of a linux-router instance, script **will do cleanup**, i.e. undo most changes to system. Though, **some** changes (if needed) will **not** be undone, which are:
|
||||||
|
|
||||||
1. `/proc/sys/net/ipv4/ip_forward = 1` and `/proc/sys/net/ipv6/conf/all/forwarding = 1`
|
1. `/proc/sys/net/ipv4/ip_forward = 1` and `/proc/sys/net/ipv6/conf/all/forwarding = 1`
|
||||||
2. dnsmasq (if used) in Apparmor complain mode
|
2. dnsmasq in Apparmor complain mode
|
||||||
3. hostapd (if used) in Apparmor complain mode
|
3. hostapd in Apparmor complain mode
|
||||||
4. Kernel module `nf_nat_pptp` loaded
|
4. Kernel module `nf_nat_pptp` loaded
|
||||||
5. The wifi device which is used to create hotspot is `rfkill unblock`ed
|
5. The wifi device which is used to create hotspot is `rfkill unblock`ed
|
||||||
6. WiFi country code, if user assigns
|
6. WiFi country code, if user assigns
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
1-file-script. Download and run (meet the dependencies).
|
||||||
|
|
||||||
|
I'm currently not packaging for any distro. If you do, open a PR and add the link (can be with a version badge) to list here:
|
||||||
|
|
||||||
|
| Linux distro | |
|
||||||
|
| ------------ | ---------------------------------------------------------------------------------------------------------- |
|
||||||
|
| Any | download [1-file-script](https://raw.githubusercontent.com/garywill/linux-router/master/lnxrouter) and run |
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
- bash
|
- bash
|
||||||
@@ -409,20 +425,18 @@ On exit of a linux-router instance, script **will do cleanup**, i.e. undo most c
|
|||||||
- iw
|
- iw
|
||||||
- iwconfig (you only need this if 'iw' can not recognize your adapter)
|
- iwconfig (you only need this if 'iw' can not recognize your adapter)
|
||||||
- haveged (optional)
|
- haveged (optional)
|
||||||
- qrencode (optional)
|
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
<details>
|
Sooner is better:
|
||||||
|
- Detect firewalld and make sure it won't interfere our interface
|
||||||
|
|
||||||
- Compatibility with firewalld
|
Future:
|
||||||
- WPA3
|
- WPA3
|
||||||
- Global IPv6
|
- Global IPv6
|
||||||
- Explictly ban forwarding if not needed
|
- Explictly ban forwarding if not needed
|
||||||
- Bring bridging method back
|
- Bring bridging method back
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
linux-router is LGPL licensed
|
linux-router is LGPL licensed
|
||||||
@@ -486,7 +500,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
Visit [**my homepage** 🏡](https://garywill.github.io) to see **more tools and projects** 🛠️.
|
Visit [**my homepage** 🏡](https://garywill.github.io) to see **more tools and projects** 🛠️.
|
||||||
|
|
||||||
> [❤️ Buy me a coffee](https://github.com/garywill/receiving/blob/master/receiving_methods.md) , this project took me lots of time! ([❤️ 扫个码打赏一个!](https://github.com/garywill/receiving/blob/master/receiving_methods.md))
|
> [❤️ Buy me a coffee](https://github.com/garywill/receiving/blob/master/receiving_methods.md) , this project took me lots of time! ([❤️ 扫码领红包并打赏一个!](https://github.com/garywill/receiving/blob/master/receiving_methods.md))
|
||||||
>
|
>
|
||||||
> 🥂 ( ^\_^) o自自o (^_^ ) 🍻
|
> 🥂 ( ^\_^) o自自o (^_^ ) 🍻
|
||||||
|
|
||||||
|
|||||||
103
lnxrouter
103
lnxrouter
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION=0.6.6
|
VERSION=0.6.7
|
||||||
PROGNAME="$(basename $0)"
|
PROGNAME="$(basename $0)"
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
@@ -67,25 +67,27 @@ Options:
|
|||||||
-d DNS server will take into account /etc/hosts
|
-d DNS server will take into account /etc/hosts
|
||||||
-e <hosts_file> DNS server will take into account additional
|
-e <hosts_file> DNS server will take into account additional
|
||||||
hosts file
|
hosts file
|
||||||
|
--dns-nocache DNS server no cache
|
||||||
|
|
||||||
--mac <MAC> Set MAC address
|
--mac <MAC> Set MAC address
|
||||||
--random-mac Use random MAC address
|
--random-mac Use random MAC address
|
||||||
|
|
||||||
--tp <port> Transparent proxy,
|
--tp <port> Transparent proxy,
|
||||||
redirect non-LAN TCP and UDP traffic to port.
|
redirect non-LAN TCP and UDP(not tested) traffic to
|
||||||
(usually used with '--dns')
|
port. (usually used with '--dns')
|
||||||
|
|
||||||
WiFi hotspot options:
|
WiFi hotspot options:
|
||||||
--ap <wifi interface> <SSID>
|
--ap <wifi interface> <SSID>
|
||||||
Create WiFi access point
|
Create WiFi access point
|
||||||
-p, --password <password>
|
-p, --password <password>
|
||||||
WiFi password
|
WiFi password
|
||||||
--qr Show WiFi QR code in terminal
|
--qr Show WiFi QR code in terminal (need qrencode)
|
||||||
|
|
||||||
--hidden Hide access point (not broadcast SSID)
|
--hidden Hide access point (not broadcast SSID)
|
||||||
--no-virt Do not create virtual interface
|
--no-virt Do not create virtual interface
|
||||||
Using this you can't use same wlan interface
|
Using this you can't use same wlan interface
|
||||||
for both Internet and AP
|
for both Internet and AP
|
||||||
|
--virt-name <name> Set name of virtual interface
|
||||||
-c <channel> Channel number (default: 1)
|
-c <channel> Channel number (default: 1)
|
||||||
--country <code> Set two-letter country code for regularity
|
--country <code> Set two-letter country code for regularity
|
||||||
(example: US)
|
(example: US)
|
||||||
@@ -156,6 +158,7 @@ define_global_variables(){
|
|||||||
SHOW_DNS_QUERY=0 # log dns
|
SHOW_DNS_QUERY=0 # log dns
|
||||||
ETC_HOSTS=0
|
ETC_HOSTS=0
|
||||||
ADDN_HOSTS=
|
ADDN_HOSTS=
|
||||||
|
DNS_NOCACHE=
|
||||||
CONN_IFACE= # which interface user choose to use to create network
|
CONN_IFACE= # which interface user choose to use to create network
|
||||||
INTERNET_IFACE= # which interface to get Internet from
|
INTERNET_IFACE= # which interface to get Internet from
|
||||||
THISHOSTNAME= # this host's name the DNS tells clients
|
THISHOSTNAME= # this host's name the DNS tells clients
|
||||||
@@ -195,6 +198,7 @@ define_global_variables(){
|
|||||||
|
|
||||||
# script variables
|
# script variables
|
||||||
VWIFI_IFACE= # virtual wifi interface name, if created
|
VWIFI_IFACE= # virtual wifi interface name, if created
|
||||||
|
VIRT_NAME= # name to use for virtual interface if --virt-name is used
|
||||||
AP_IFACE= # can be VWIFI_IFACE or WIFI_IFACE
|
AP_IFACE= # can be VWIFI_IFACE or WIFI_IFACE
|
||||||
USE_IWCONFIG=0 # some device can't use iw
|
USE_IWCONFIG=0 # some device can't use iw
|
||||||
|
|
||||||
@@ -322,6 +326,10 @@ parse_user_options(){
|
|||||||
ADDN_HOSTS="$1"
|
ADDN_HOSTS="$1"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--dns-nocache)
|
||||||
|
shift
|
||||||
|
DNS_NOCACHE=1
|
||||||
|
;;
|
||||||
|
|
||||||
--isolate-clients)
|
--isolate-clients)
|
||||||
shift
|
shift
|
||||||
@@ -399,6 +407,11 @@ parse_user_options(){
|
|||||||
shift
|
shift
|
||||||
NO_VIRT=1
|
NO_VIRT=1
|
||||||
;;
|
;;
|
||||||
|
--virt-name)
|
||||||
|
shift
|
||||||
|
VIRT_NAME="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
--country)
|
--country)
|
||||||
shift
|
shift
|
||||||
@@ -505,6 +518,10 @@ is_interface() {
|
|||||||
[[ -d "/sys/class/net/${1}" ]]
|
[[ -d "/sys/class/net/${1}" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_vface_name_allocated(){
|
||||||
|
is_interface "$1" || [[ -f "$COMMON_CONFDIR/vfaces/${1}" ]]
|
||||||
|
}
|
||||||
|
|
||||||
get_interface_phy_device() { # only for wifi interface
|
get_interface_phy_device() { # only for wifi interface
|
||||||
local x
|
local x
|
||||||
for x in /sys/class/ieee80211/*; do
|
for x in /sys/class/ieee80211/*; do
|
||||||
@@ -626,19 +643,44 @@ get_interface_mac() {
|
|||||||
cat "/sys/class/net/${1}/address"
|
cat "/sys/class/net/${1}/address"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_interface_pci_info() { # pci id / model / virtual
|
||||||
|
is_interface "$1" || return
|
||||||
|
|
||||||
|
local device_path
|
||||||
|
local pci_id
|
||||||
|
local pci_full
|
||||||
|
|
||||||
|
device_path="$(readlink -f /sys/class/net/$1)"
|
||||||
|
|
||||||
|
if [[ "$device_path" == "/sys/devices/pci"* ]]; then
|
||||||
|
pci_id="$(echo $device_path | sed 's/\//\n/g' | tail -n 3 |sed -n 1p)"
|
||||||
|
|
||||||
|
if which lspci >/dev/null 2>&1 ; then
|
||||||
|
pci_full="$( lspci -D -nn | grep -E "^$pci_id " )"
|
||||||
|
echo " PCI: $pci_full"
|
||||||
|
else
|
||||||
|
echo " PCI: $pci_id"
|
||||||
|
fi
|
||||||
|
elif [[ "$device_path" == *"/virtual/"* ]]; then
|
||||||
|
echo " virtual interface"
|
||||||
|
fi
|
||||||
|
# TODO usb
|
||||||
|
# TODO current driver
|
||||||
|
}
|
||||||
|
|
||||||
alloc_new_vface_name() { # only for wifi
|
alloc_new_vface_name() { # only for wifi
|
||||||
local i=0
|
local i=0
|
||||||
local v_iface_name=
|
local v_iface_name="$VIRT_NAME"
|
||||||
|
if [[ -z $VIRT_NAME ]]; then
|
||||||
while :; do
|
while :; do
|
||||||
v_iface_name="x$i${WIFI_IFACE}"
|
v_iface_name="x$i${WIFI_IFACE}"
|
||||||
if ! is_interface ${v_iface_name} && [[ ! -f $COMMON_CONFDIR/vfaces/${v_iface_name} ]]; then
|
i=$((i + 1))
|
||||||
|
is_vface_name_allocated ${v_iface_name} || break
|
||||||
|
done
|
||||||
|
fi
|
||||||
mkdir -p $COMMON_CONFDIR/vfaces
|
mkdir -p $COMMON_CONFDIR/vfaces
|
||||||
touch $COMMON_CONFDIR/vfaces/${v_iface_name}
|
touch $COMMON_CONFDIR/vfaces/${v_iface_name}
|
||||||
echo "${v_iface_name}"
|
echo "${v_iface_name}"
|
||||||
return
|
|
||||||
fi
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dealloc_vface_name() {
|
dealloc_vface_name() {
|
||||||
@@ -995,7 +1037,7 @@ allow_dhcp() {
|
|||||||
# TODO: use 'DNAT' instead of '--to-ports' to support other IP
|
# TODO: use 'DNAT' instead of '--to-ports' to support other IP
|
||||||
start_redsocks() {
|
start_redsocks() {
|
||||||
echo
|
echo
|
||||||
echo "iptables: transparent proxy non-LAN TCP/UDP traffic to port ${TP_PORT}"
|
echo "iptables: transparent proxy non-LAN TCP and UDP(not tested) traffic to port ${TP_PORT}"
|
||||||
if [[ $NO4 -eq 0 ]]; then
|
if [[ $NO4 -eq 0 ]]; then
|
||||||
iptb 4 n nat N lrt${$}${SUBNET_IFACE}-TP || die
|
iptb 4 n nat N lrt${$}${SUBNET_IFACE}-TP || die
|
||||||
iptb 4 n nat A lrt${$}${SUBNET_IFACE}-TP -d 0.0.0.0/8 -j RETURN || die
|
iptb 4 n nat A lrt${$}${SUBNET_IFACE}-TP -d 0.0.0.0/8 -j RETURN || die
|
||||||
@@ -1158,7 +1200,7 @@ _cleanup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean_iptables() {
|
clean_iptables() {
|
||||||
bash $CONFDIR/undo_iptables.sh
|
[[ -f $CONFDIR/undo_iptables.sh ]] && bash $CONFDIR/undo_iptables.sh
|
||||||
|
|
||||||
[[ -f $CONFDIR/undo_iptables_2.sh ]] && bash $CONFDIR/undo_iptables_2.sh
|
[[ -f $CONFDIR/undo_iptables_2.sh ]] && bash $CONFDIR/undo_iptables_2.sh
|
||||||
}
|
}
|
||||||
@@ -1173,15 +1215,15 @@ cleanup() {
|
|||||||
clean_iptables > /dev/null
|
clean_iptables > /dev/null
|
||||||
_cleanup 2> /dev/null
|
_cleanup 2> /dev/null
|
||||||
|
|
||||||
pgid=$(ps opgid= $$ |awk '{print $1}' )
|
#pgid=$(ps opgid= $$ |awk '{print $1}' )
|
||||||
echo "Killing PGID $pgid ..."
|
#echo "Killing PGID $pgid ..."
|
||||||
kill -15 -$pgid
|
#kill -15 -$pgid
|
||||||
sleep 1
|
#sleep 1
|
||||||
echo "Cleaning up done"
|
echo "Cleaning up done"
|
||||||
#kill -9 -$pgid
|
#kill -9 -$pgid
|
||||||
}
|
}
|
||||||
|
|
||||||
# NOTE function die() is designed not to be used before init_trap() executed
|
# NOTE function die() is designed NOT to be used before init_trap() executed
|
||||||
die() { # SIGUSR2
|
die() { # SIGUSR2
|
||||||
echo "Error occured"
|
echo "Error occured"
|
||||||
[[ -n "$1" ]] && echo -e "\nERROR: $1\n" >&2
|
[[ -n "$1" ]] && echo -e "\nERROR: $1\n" >&2
|
||||||
@@ -1543,6 +1585,18 @@ check_wifi_settings() {
|
|||||||
fi
|
fi
|
||||||
echo "WARN: If AP doesn't work, read https://github.com/oblique/create_ap/blob/master/howto/realtek.md" >&2
|
echo "WARN: If AP doesn't work, read https://github.com/oblique/create_ap/blob/master/howto/realtek.md" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z $VIRT_NAME ]]; then
|
||||||
|
if [[ ${#WIFI_IFACE} -gt 13 ]]; then
|
||||||
|
echo "WARN: $WIFI_IFACE has ${#WIFI_IFACE} characters which might be too long. If AP doesn't work, see --virt-name and https://github.com/garywill/linux-router/issues/44" >&2
|
||||||
|
fi
|
||||||
|
elif [[ ${#VIRT_NAME} -gt 15 ]]; then
|
||||||
|
echo "WARN: option --virt-name $VIRT_NAME has ${#VIRT_NAME} characters which might be too long, consider making it shorter in case of errors" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z $VIRT_NAME ]] && is_vface_name_allocated $VIRT_NAME; then
|
||||||
|
echo "WARN: interface $VIRT_NAME aleady exists, this will cause an error"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_if_new_mac_valid() {
|
check_if_new_mac_valid() {
|
||||||
@@ -1620,8 +1674,14 @@ prepare_wifi_interface() {
|
|||||||
echo "${VWIFI_IFACE} created"
|
echo "${VWIFI_IFACE} created"
|
||||||
else
|
else
|
||||||
VWIFI_IFACE=
|
VWIFI_IFACE=
|
||||||
|
if [[ ! -z ${VIRT_NAME} ]] && [[ ${#VIRT_NAME} -gt 15 ]]; then
|
||||||
|
die "Failed creating virtual WiFi interface. This is likely because you have set a long name for your virtual interface using --virt-name, try making it shorter'"
|
||||||
|
elif [[ -z ${VIRT_NAME} ]] && [[ ${#WIFI_IFACE} -gt 13 ]]; then
|
||||||
|
die "Failed creating virtual WiFi interface. This is likely because your interface name is too long. Try using '--virt-name <shorter interface name>'"
|
||||||
|
else
|
||||||
die "Failed creating virtual WiFi interface. Maybe your WiFi adapter does not fully support virtual interfaces. Try again with '--no-virt'"
|
die "Failed creating virtual WiFi interface. Maybe your WiFi adapter does not fully support virtual interfaces. Try again with '--no-virt'"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
AP_IFACE=${VWIFI_IFACE}
|
AP_IFACE=${VWIFI_IFACE}
|
||||||
else # no virtual wifi interface, use wifi device interface itself
|
else # no virtual wifi interface, use wifi device interface itself
|
||||||
@@ -1796,6 +1856,10 @@ write_dnsmasq_conf() {
|
|||||||
no-poll
|
no-poll
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
if [[ $DNS_NOCACHE -eq 1 ]]; then
|
||||||
|
echo "cache-size=0" >> "$CONFDIR/dnsmasq.conf"
|
||||||
|
echo "no-negcache" >> "$CONFDIR/dnsmasq.conf"
|
||||||
|
fi
|
||||||
if [[ $IPV6 -eq 1 ]];then
|
if [[ $IPV6 -eq 1 ]];then
|
||||||
cat <<- EOF >> "$CONFDIR/dnsmasq.conf"
|
cat <<- EOF >> "$CONFDIR/dnsmasq.conf"
|
||||||
listen-address=${GATEWAY6}
|
listen-address=${GATEWAY6}
|
||||||
@@ -1928,8 +1992,7 @@ echo
|
|||||||
echo "PID: $$"
|
echo "PID: $$"
|
||||||
|
|
||||||
TARGET_IFACE="$(decide_target_interface)" || exit 1 # judge wired (-i CONN_IFACE) or wireless hotspot (--ap $WIFI_IFACE)
|
TARGET_IFACE="$(decide_target_interface)" || exit 1 # judge wired (-i CONN_IFACE) or wireless hotspot (--ap $WIFI_IFACE)
|
||||||
echo "Target interface is ${TARGET_IFACE} ($(get_interface_mac $TARGET_IFACE))"
|
echo "Target interface is ${TARGET_IFACE} ($(get_interface_mac $TARGET_IFACE)) $(get_interface_pci_info $TARGET_IFACE)"
|
||||||
# TODO: show interface type, device model and pci/usb id (hwdata pci.ids), current driver
|
|
||||||
|
|
||||||
if [[ "$MAC_USE_RANDOM" -eq 1 ]] ; then
|
if [[ "$MAC_USE_RANDOM" -eq 1 ]] ; then
|
||||||
NEW_MACADDR="$(generate_random_mac)"
|
NEW_MACADDR="$(generate_random_mac)"
|
||||||
@@ -2065,7 +2128,7 @@ fi
|
|||||||
[[ $NO_DNSMASQ -eq 0 ]] && ( allow_dhcp ; start_dnsmasq )
|
[[ $NO_DNSMASQ -eq 0 ]] && ( allow_dhcp ; start_dnsmasq )
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "== Setting up completed, now linux-router is working =="
|
echo "== Setting up completed, now linux-router should be working =="
|
||||||
|
|
||||||
#============================================================
|
#============================================================
|
||||||
#============================================================
|
#============================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user