Участник с: 29 ноября 2014
|
Как то так.
/etc/dhcpcd.enter-hook
if [ "$reason" = "BOUND" -o "$reason" = "REBOOT" ]; then
if [ -n "$new_ms_classless_static_routes" -o -n "$new_classless_static_routes" ]; then
if [ -n "$new_routers" ]; then
if [ -n "$old_routers" ]; then
routers=($old_routers)
for router in "${routers[@]}"; do
if [[ -n "$(which ip 2>/dev/null)" ]]; then
ip route del to default via $router
else
route del default gw $router
fi
done
fi
routers=($new_routers)
for router in "${routers[@]}"; do
if [[ -n "$(which ip 2>/dev/null)" ]]; then
ip route add to default via $router
else
route add default gw $router
fi
done
fi
fi
fi
/etc/dhcpcd.conf
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option subnet_mask, routers, time_offset
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes, classless_static_routes, ms_classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
#option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname
noipv4ll
/etc/ppp/ip-up.d/ip-up.sh
#!/bin/sh
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
GATEWAY=`route | grep ^default | awk '{print $2}'`
ip r a 85.21.0.0/24 via "ваш gw"
ip r d default
ip r a default dev ppp0
(
echo '#!/bin/sh'
echo 'PATH="/sbin:/bin:/usr/sbin:/usr/bin"'
echo 'route del default'
echo "route add default gateway $GATEWAY"
) >/etc/ppp/ip-down
chmod +x /etc/ppp/ip-up.d/ip-up.sh
systemctl disable dhcpcd systemctl enable netctl
cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/net0-p "ваше имя профиля"
netctl enable net0-p "ваше имя профиля"
/etc/netctl/net0-p"ваше имя профиля"
Description='A basic dhcp ethernet connection'
Interface="ваш интерфейс Ethernet"
Connection=ethernet
IP=dhcp
## for DHCPv6
#IP6=dhcp
## for IPv6 autoconfiguration
#IP6=stateless
/etc/xl2tpd/xl2tpd.conf
[global]
port = 1701
access control = no
rand source = dev
[lac corbina]
lns = tp.corbina.net
redial = yes
redial timeout = 5
require pap = no
require chap = yes
require authentication = no
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
autodial = yes
tunnel rws = 8
tx bps = 100000000
rx bps = 100000000
/etc/ppp/options.xl2tpd
unit 0
name "ваш логин"
remotename l2tp
ipparam beeline
connect /bin/true
nodeflate
nobsdcomp
noproxyarp
mru 1500
mtu 1500
persist
holdoff 10
maxfail 0
nopcomp
noauth
noaccomp
defaultroute
/etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
"ваш логин" * "ваш пароль"
без кавычек
systemctl enable xl2tpd
|