Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@dra7xx-evm:~# cat /etc/init.d/bridge.sh
- #!/bin/bash
- #
- ### BEGIN INIT INFO
- # Provides: bridge
- # Required-Start: $remote_fs
- # Required-Stop: $remote_fs
- # Default-Start: 2 3 5
- # Default-Stop: 0 1 6
- # Short-Description: Setup vif bridge
- # Description: Start/stop bridge
- ### END INIT INFO
- #
- PATH="/sbin:/usr/sbin:/usr/local/sbin";
- slaveIfs="1 2 3 4 6 7 8 9 10";
- cmd="$1";
- [ -z "$cmd" ] && cmd="start";
- case "$cmd" in
- startcddbr br0;
- brctl addif br0 eth0;
- brctl addif br0 vif2.1;
- (ifdown eth0 1>/dev/null 2>&1;);
- ifconfig eth0 0.0.0.0 up;
- ifconfig vif2.1 0.0.0.0 up;
- for file in br0 eth0 vif2.1;
- do
- echo "1" > /proc/sys/net/ipv4/conf/${file}/proxy_arp;
- echo "1" > /proc/sys/net/ipv4/conf/${file}/forwarding;
- done;
- echo "1" > /proc/sys/net/ipv4/ip_forward;
- /etc/init.d/networking restart;
- ;;
- stop)
- ifconfig br0 down;
- brctl delbr br0;
- ifconfig br1 down;
- brctl delbr br1;
- ifconfig br2 down;
- brctl delbr br2;
- #ifup eth0; ### Adapt to your needs.
- #ifup eth1; ### Adapt to your needs.
- ;;
- restart,reload)
- $0 stop;
- sleep 3;
- $0 start;
- ;;
- esac;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement