|
|
#!/bin/bash, D. w- c) g- n! F g1 R
####+ v9 E0 I! T6 b- A+ F {. d
ETH=`ip addr |grep eth |grep "state UP" |grep -v eth0 |awk -F ":" '{print $2}'|xargs`$ S; Q( R7 E$ q7 X8 \
while [ "$ETH " != "eth0" ]
4 L8 M* D2 E% Odo( v" M1 [* T# N& d, i
if [ "$ETH" == "eth1" ];then- L# m- R- c) E1 y! v
cat >/etc/sysctl.conf <<EOF, c! L3 M4 d+ |
# sysctl settings are defined through files in" c/ k; f7 f- z- w3 {
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.) H' v( x) i/ n. |2 ?
#
% C! ?& q1 b, p" x0 W# Vendors settings live in /usr/lib/sysctl.d/.
0 j9 J, ]/ ~- F1 Y# To override a whole file, create a new file with the same in6 s4 w7 t. |# i
# /etc/sysctl.d/ and put new settings there. To override
8 [8 x* i1 [+ T9 g# only specific settings, add a file with a lexically later
0 m1 o( m$ }/ h0 G; E. g+ y# name in /etc/sysctl.d/ and put new settings there.6 N+ R8 n {( g4 `8 Q$ i1 Q
#' Y m. C- f7 H: q" P
# For more information, see sysctl.conf(5) and sysctl.d(5).
# |1 ~" o+ s$ d4 ]- V vnet.ipv4.conf.all.rp_filter = 0
0 U& b Z- A! a7 Y( a* Dnet.ipv4.conf.eth0.rp_filter = 0 7 t, ^1 |' ]8 X& p
net.ipv4.conf.$ETH.rp_filter = 0
) i! f7 X" O4 jEOF
% {( I" N" W0 `1 G& o8 I else5 N1 v& M% S# c# v# _
cat >/etc/sysctl.conf <<EOF2 \& W, H; I) ]1 u7 [8 M8 ~: W
# sysctl settings are defined through files in
3 |' b' ?9 U( C5 D# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
f5 y l4 L9 D; N8 w; J5 x#! M1 |0 a( g. P% s+ q
# Vendors settings live in /usr/lib/sysctl.d/.
0 Y: g7 }- R8 N0 s/ x4 G# To override a whole file, create a new file with the same in" Z v% N0 y+ K% v- {. _* e
# /etc/sysctl.d/ and put new settings there. To override4 Q; t9 W7 E+ a$ t6 N5 B' D- d
# only specific settings, add a file with a lexically later: H" \7 L9 M# o- k4 `3 B
# name in /etc/sysctl.d/ and put new settings there.# a$ e& E! }# r( t, K
#
! a2 q) z7 h4 @8 O8 z0 j0 m! U# For more information, see sysctl.conf(5) and sysctl.d(5).& T" C# n/ v4 U7 k5 e' |/ ]
net.ipv4.conf.all.rp_filter = 0& l& V' |9 l2 N% ] X8 g( g$ u+ y
net.ipv4.conf.eth0.rp_filter = 0 7 u+ k6 P: L1 @0 _
EOF
. q' r5 H. k- ]+ J U; Efi
. B; k% P0 O/ v! B& }% U7 Z( S###kernel on
) _2 O, h/ u, `" I0 B- Fsysctl -p
+ ]" [" E0 o% L5 K, c/ v1 k- w- f" gsleep 300( Q# v% A: p1 i8 p; N& L' S
done
5 F6 K! x4 ^1 t9 G2 ^0 V) texit 03 `" _# i: v2 H) Z" U. i" s
|
|