Re: preserving l2tp
Niv Wiser
Sun Jan 02 21:44:19 2011
yes
ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Dec 2 11:11 /bin/sh -> bash
ever since dropping net.br0 I can't get my pc to act as a router.
I used arno-iptables-scripts to NAT br0 to eth0 and now ppp0.
br0 is a bridge made up of eth1,wlan2(running hostapd), and tap0
(allowing openvpn connections)
dnsmasq supplies dhcp and dns
how do I get all this to work using dhcpcd and openrc?
my /etc/conf.d/net:
############# Ethernet
config_eth0="dhcp"
config_eth1="null"
#config_eth1="192.168.14.70/24"
############# Wireless
# DWA-552 Xtreme N
config_wlan2="null"
channel_wlan2="6"
essid_wlan2="test"
mode_wlan2="master"
############# TUN/TAP
modules="openvpn bridge !netplug"
tuntap_tap0="tap"
#config_tap0=( "null" )
config_tap0=( "0.0.0.0/24" )
############# Bridging (802.1d)
config_br0="192.168.14.70/24"
brctl_br0='stp on'
bridge_add_eth1='br0'
#first openvpn starts and only then add it to br0 bridge_add_tap0="br0"
bridge_add_wlan2="br0"
rc_use_br0='net.eth1 hostapd'
rc_need_tap0='openvpn.tapWhitey'
############# misc
# This is only of use for WakeOnLan
ifdown_eth0="NO"
############ system
postup() {
WAN_GW=$(ip ro |grep $VPN_HOST |sed "s/.*via\ //"|sed "s/\ dev.*//")
if [ "${IFACE}" == "lo" ] ; then
return 0
fi
case "${IFACE}" in
lo)
break
;;
ppp0)
sed -i "s/^EXT_IF=.*/EXT_IF=${IFACE}"/ /etc/arno-iptables-firewall/firewall.conf
/usr/bin/rc-config restart arno-iptables-firewall
/usr/bin/rc-config restart dnsmasq
;;
eth0)
ip ro | grep -q default || ip ro add default via $WAN_GW
sed -i "s/^EXT_IF=.*/EXT_IF=${IFACE}"/ /etc/arno-iptables-firewall/firewall.conf
#shields up except on boot when eth0 is the first to show up
[ -d /sys/class/net/br0 ] && /usr/bin/rc-config restart arno-iptables-firewall
#fix missing ISP dns, but since installing openresolv, its useless
grep -q nameserver /etc/resolv.conf || cp /etc/resolv.conf.hot /etc/resolv.conf
;;
ra0)
einfo "wireless connected to ${ESSID}"
#useless since emerging openresolv while true; do
# grep -q nameserver /etc/resolv.conf
# [ $? -eq 0 ] && break
# einfo "waiting to establish connction"
# sleep 1
#done
sed -i s/^EXT_IF=.*/EXT_IF=\"${IFACE}\"/
/etc/conf.d/arno-iptables-firewall
/usr/bin/rc-config restart arno-iptables-firewall
/usr/bin/rc-config restart dnsmasq
/usr/bin/rc-config restart openvpn
;;
tap0)
if [ ! `fgrep -q ${IFACE} /etc/dnsmasq.conf ` ] ; then
echo "except-interface=${IFACE}">>/etc/dnsmasq.conf
/usr/bin/rc-config restart dnsmasq
fi
;;
esac
return 0
}
predown() {
# if IFACE is a bridge , stop all of its ports then take it down
if [ -d /sys/class/*net*/${IFACE}/bridge ] ; then
for x in /sys/class/*net*/"${IFACE}"/brif/* ; do
brif=$(x##*/)
/etc/init.d/net.${brif} stop
done
fi
# if IFACE is a member of a bridge remove it from the bridge
# before stoping it
if [ -e /sys/class/*net*/${IFACE}/brport/port_id ]; then
einfo "removing ${IFACE} from bridge"
x=$(ls -l /sys/class/*net*/${IFACE}/brport/bridge 2>/dev/null )
brif=${x##*/}
/sbin/brctl delif ${brif} ${IFACE} || return 1
fi
return 0
}
postdown() {
if [ "${IFACE}" == "lo" ] ; then
return 0
fi
case "${IFACE}" in
tap0)
fgrep -q "${IFACE}" /etc/dnsmasq.conf
if [ $? -eq 0 ] ; then
sed -i "/^except-interface=${IFACE}$/d" /etc/dnsmasq.conf
/usr/bin/rc-config restart dnsmasq
fi
;;
lo|br0|ppp0)
break
;;
*)
ethtool -s "${IFACE}" wol g
esac
return 0
}
my dhcpcd.conf:
hostname
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
option interface_mtu
require dhcp_server_identifier
nohook lookup-hostname
denyinterfaces eth1 wlan2 tap0
interface br0
static ip_address=192.168.14.70/24
static routers=
Archive administrator: postmaster@marples.name