标签:network,管理系统,ifcfg,拨号,sysconfig,etc,ppp,scripts From: https://blog.51cto.com/hequan/6076932
ifconfig eth0 promisc
ip link set eth0 promisc on
sed -i '/PROMISC/d' /etc/sysconfig/network-scripts/ifcfg-eth0
echo "PROMISC=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i "/$account/d" /etc/ppp/chap-secrets
echo "\"$account\" * \"$password\"" >> /etc/ppp/chap-secrets
sed -i "/$account/d" /etc/ppp/pap-secrets
echo "\"$account\" * \"$password"\" >> /etc/ppp/pap-secrets
cat << EOF > "/etc/sysconfig/network-scripts/ifcfg-eth0.101"
DEVICE=eth0.101
BOOTPROTO=none
ONBOOT=yes
VLAN=yes
EOF
ifup eth0
cat <<EOF > "/etc/sysconfig/network-scripts/ifcfg-macv0"
DEVICE=macv0
DEVICETYPE=macvlan
TYPE=macvlan
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
MACVLAN_PARENT=eth0.101
MACVLAN_MODE=bridge
MACADDR=00:84:81:46:cf:f4
EOF
/sbin/ifup-macvlan macv0
cat <<EOF > "/etc/sysconfig/network-scripts/ifcfg-ppp0"
USERCTL=yes
BOOTPROTO=dialup
NAME=DSL$ppp_name
DEVICE=$ppp_name
TYPE=xDSL
ONBOOT=no
PIDFILE=/var/run/pppoe-adsl-${ppp_name}.pid
FIREWALL=NONE
PING=.
PPPOE_TIMEOUT=80
LCP_FAILURE=10
LCP_INTERVAL=20
CLAMPMSS=1412
CONNECT_POLL=6
CONNECT_TIMEOUT=60
DEFROUTE=no
SYNCHRONOUS=no
ETH=$dev_name
PROVIDER=DSL$ppp_name
USER=$username
PEERDNS=no
DEMAND=no
LINUX_PLUGIN=/usr/lib64/pppd/2.4.5/rp-pppoe.so
METRIC=$metric
EOF
ifup ppp0
ip route add default dev $nic table $rttbl
ip rule add from all oif $nic table $rttbl
ip rule add from $ipaddr lookup $rttbl
ip rule del $line