1.1ubuntu安裝網橋命令: sudo apt-get install bridge-utils
1.2centos安裝網橋命令: yum install bridge-utils
2.1網橋的使用 終端輸入命令:
liang@liang-pc:~$ brctl -h
usage: brctl [commands]
commands:
addbr
add bridge
delbr
delete bridge
addif
add inte***ce to bridge
delif
delete inte***ce from bridge
hairpin
turn hairpin on/off
setageing
set ageing time
setbridgeprio
set bridge priority
setfd
set bridge forward delay
sethello
set hello time
setmaxage
set max message age
setpathcost
set path cost
setportprio
set port priority
show [
] show a list of bridges
showmacs
show a list of mac addrs
showstp
show bridge stp info
stp
turn stp on/off
2.2建立網橋 新增乙個網橋:
brctl addbr br0
停止生成樹協議:
brctl stp br0 off
2.3新增網絡卡裝置到網橋 新增兩塊網絡卡到網橋:
brctl addif br0 eth0
brctl addif br0 eth1
ifconfig eth0 down
ifconfig eth1 down
ifconfig eth0 0.0.0.0 up
ifconfig eth1 0.0.0.0 up
因為兩塊網絡卡作為網橋的兩個介面,這兩個介面分別連線兩個不同的網路,支援兩個網路的正常通訊,不再需要ip,只需要傳遞網路流量即可。
3.1透明網橋的ip設定 網橋的ip設定:
ifconfig br0 10.0.3.129 up (注意這樣的網橋並不是透明網橋,因為使用的真實的ip位址,其他網路裝置可見)
透明網橋的ip位置:
ifconfig br0 0.0.0.0 up (這樣網橋就沒有ip位址,其他裝置就無法感知網橋的存在。到此,透明網橋基本配置完成,透明閘道器的屬性自然有了,但是透明防火牆的功能沒有完全支援,繼續往下。)
4.1防火牆的使用 終端輸入命令:
liang@liang-pc:~$ iptables -h
iptables v1.4.21
usage: iptables -[acd] chain rule-specification [options]
iptables -i chain [rulenum] rule-specification [options]
iptables -r chain rulenum rule-specification [options]
iptables -d chain rulenum [options]
iptables -[ls] [chain [rulenum]] [options]
iptables -[fz] [chain] [options]
iptables -[nx] chain
iptables -e old-chain-name new-chain-name
iptables -p chain target [options]
iptables -h (print this help information)
commands:
either long or short options are allowed.
--check -c chain check for the existence of a rule
--delete -d chain delete matching rule from chain
--delete -d chain rulenum
delete rule rulenum (1 = first) from chain
--insert -i chain [rulenum]
insert in chain as rulenum (default 1=first)
--replace -r chain rulenum
replace rule rulenum (1 = first) in chain
--list -l [chain [rulenum]]
list the rules in a chain or all chains
--list-rules -s [chain [rulenum]]
print the rules in a chain or all chains
--flush -f [chain] delete all rules in chain or all chains
--zero -z [chain [rulenum]]
zero counters in chain or all chains
--new -n chain create a new user-defined chain
--delete-chain
-x [chain] delete a user-defined chain
--policy -p chain target
change policy on chain to target
--rename-chain
-e old-chain new-chain
change chain name, (moving any references)
options:
--ipv4 -4 nothing (line is ignored by ip6tables-restore)
--ipv6 -6 error (line is ignored by iptables-restore)
[!] --protocol -p proto protocol: by number or name, eg. `tcp'
[!] --source -s address[/mask][...]
source specification
[!] --destination -d address[/mask][...]
destination specification
[!] --in-inte***ce -i input name[+]
network inte***ce name ([+] for wildcard)
--jump -j target
target for rule (may load target extension)
--goto -g chain
jump to chain with no return
--match -m match
extended match (may load extension)
--numeric -n numeric output of addresses and ports
[!] --out-inte***ce -o output name[+]
network inte***ce name ([+] for wildcard)
--table -t table table to manipulate (default: `filter')
--verbose -v verbose mode
--wait -w wait for the xtables lock
--line-numbers print line numbers when listing
--exact -x expand numbers (display exact values)
[!] --fragment -f match second or further fragments only
--modprobe=try to insert modules using this command
[!] --version -v print package version.
5.1配置透明防火牆 配置網橋後發現經過網橋的流量並沒有受到iptables防火的控制,原因是系統沒有開啟網橋支援防火牆的配置:
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
同樣,bridge-nf-call-arptables、bridge-nf-call-ip6tables。到這裡,透明防火牆也配置完畢,此時經過網橋的流量就受到防火牆的控制。
防火牆透明模式
1,特性介紹 防火牆作為一實際存在的物理裝置,其本身也起到路由的作用,所以在為使用者安裝防火牆時,就需要考慮如何改動其原有的網路拓撲結構或修改連線防火牆的路由表,以適應使用者的實際需要,這樣就增加了工作的複雜程度和難度。但如果防火牆採用了透明模式,即採用無ip方式執行,使用者將不必重新設定和修改路由...
防火牆透明模式
1,特性介紹 防火牆作為一實際存在的物理裝置,其本身也起到路由的作用,所以在為使用者安裝防火牆時,就需要考慮如何改動其原有的網路拓撲結構或修改連線防火牆的路由表,以適應使用者的實際需要,這樣就增加了工作的複雜程度和難度。但如果防火牆採用了透明模式,即採用無ip方式執行,使用者將不必重新設定和修改路由...
透明防火牆才是純粹的防火牆
早在上大學時就有乙個疑問,為什麼防火牆看起來像是一台路由器,為了引入乙個防火牆,你起碼要多申請2個ip位址,還要配置複雜的路由保證通路,為了上述保證,你不得不重新規劃你的網路,最最麻煩的就是為你的那個防火牆分配的那個ip位址,該位址可能會成為攻擊者進入內部網的入口。到底是誰在保護誰啊?真正意義的純粹...