Tcptraceroute:基于TCP數(shù)據(jù)包的路由跟蹤器
現(xiàn)代網(wǎng)絡(luò)廣泛使用防火墻,導(dǎo)致傳統(tǒng)路由跟蹤工具發(fā)出的(ICMP應(yīng)答(ICMP echo)或UDP)數(shù)據(jù)包都被過(guò)濾掉了,所以無(wú)法進(jìn)行完整的路由跟蹤。盡管如此,許多情況下,防火墻會(huì)準(zhǔn)許反向(inbound)TCP數(shù)據(jù)包通過(guò)防火墻到達(dá)指定端口,這些端口是主機(jī)內(nèi)防火墻背后的一些程序和外界連接用的。通過(guò)發(fā)送TCP SYN數(shù)據(jù)包來(lái)代替UDP或者ICMP應(yīng)答數(shù)據(jù)包,tcptraceroute可以穿透大多數(shù)防火墻。
下載鏈接:http://down.51cto.com/data/161567
>>去網(wǎng)絡(luò)安全工具百寶箱看看其它安全工具
一、LIBPCAP:
下載:libpcap
http://down.51cto.com/data/161564 下載 libpcap-0.8.3.tar.gz
安裝:
- tar zxvf ~lonen/Testing-pt/libpcap-0.8.3.tar.gz
- ./configure --without-flex --without-bison --prefix=/usr/local/libpcap
二、LIBNET:
下載:libnet
http://down.51cto.com/data/161565 下載libnet-1.0.2a.tar.gz
安裝:
- tar zxvf ~lonen/Testing-pt/libnet-1.0.2a.tar.gz
- ln -s Libnet-1.0.2a/ libnet
- cd libnet/
- ./configure --prefix=/usr/local/libnet
- make
- more README
- make install; make supp;make util
- make install
- make supp
三、TCPTRACEROUTE:
下載:tcptraceroute
http://down.51cto.com/data/161567 下載1.5.tar.gz
閱讀安裝幫助,牢記,養(yǎng)成閱讀英文的習(xí)慣,工作效率也能夠提高很多。真正的心得。
- [root@soft tcptraceroute-1.5beta7]# ./configure --prefix=/usr/local/tcptraceroute \
- > --with-libpcap=/usr/local/libpcap \
- > --with-libnet=/usr/local/libnet \
- > --enable-static
- make;make install
- [root@soft bin]# cp tcptraceroute /bin/
- [root@soft bin]# tcptraceroute --help
- tcptraceroute 1.5beta7
- Copyright (c) 2001-2006 Michael C. Toren <mct@toren.net>
- Updates are available from http://michael.toren.net/code/tcptraceroute/
- Usage: tcptraceroute [-nNFSAE] [-i <interface>] [-f <first ttl>]
- [-l <packet length>] [-q <number of queries>] [-t <tos>]
- [-m <max ttl>] [-pP] <source port>] [-s <source address>]
- [-w <wait time>] <host> [destination port] [packet length]
- -n
- Display numeric output, rather than doing a reverse DNS lookup for each hop. By default, reverse lookups are never attempted on RFC1918
- address space, regardless of the -n flag.
- -N
- Perform a reverse DNS lookup for each hop, including RFC1918 addresses.
- -f
- Set the initial TTL used in the first outgoing packet. The default is 1.
- -m
- Set the maximum TTL used in outgoing packets. The default is 30.
- -p
- Use the specified local TCP port in outgoing packets. The default is to obtain a free port from the kernel using bind(2). Unlike with traditional
- traceroute(8), this number will not increase with each hop.
- -s
- Set the source address for outgoing packets. See also the -i flag.
- -i
- Use the specified interface for outgoing packets.
- -q
- Set the number of probes to be sent to each hop. The default is 3.
- -w
- Set the timeout, in seconds, to wait for a response for each probe. The default is 3.
- -S
- Set the TCP SYN flag in outgoing packets. This is the default, if neither -S or -A is specified.
- -A
- Set the TCP ACK flag in outgoing packets. By doing so, it is possible to trace through stateless firewalls which permit outgoing TCP connections.
- -E
- Send ECN SYN packets, as described in RFC2481.
- -t
- Set the IP TOS (type of service) to be used in outgoing packets. The default is not to set any TOS.
- -F
- Set the IP "don't fragment" bit in outgoing packets.
- -l
- Set the total packet length to be used in outgoing packets. If the length is greater than the minimum size required to assemble the necessary probe
- packet headers, this value is automatically increased.
- -d
- Enable debugging, which may or may not be useful.
- -i 指定接口,網(wǎng)絡(luò)接口
- -f 起初第幾條開始,比如5,開始顯示第5跳的結(jié)果
- -l traceroute包的長(zhǎng)度
- -q 查詢的數(shù)字號(hào)
- -t tos
- -m ***的TTL
- -s 源地址,如果服務(wù)器有兩塊網(wǎng)卡,就可以采用指定-s的源地址路由,在所有的tracert/traceroute都 有這樣的基本功能
- -w等待的時(shí)間
- host 指定要TRACEROUTE的一個(gè)IP或者是域名 www.bloghacker.cn
#p#
四、真是有效的測(cè)試記錄對(duì)比:
- [root@soft ~]# traceroute -w 2 -q 1 -f 5 www.singtel.com.sg
- traceroute to www.singtel.com.sg (203.208.248.10), 30 hops max, 38 byte packets
- 5 219.158.4.66 (219.158.4.66) 27.322 ms
- 6 219.158.3.198 (219.158.3.198) 27.664 ms
- 7 203.208.151.17 (203.208.151.17) 92.729 ms
- 8 GigabitEthernet6-0.sngtp-ar2.ix.singtel.com (203.208.183.19) 108.016 ms
- 9 202.160.250.226 (202.160.250.226) 83.829 ms
- 10 203.208.232.50 (203.208.232.50) 91.525 ms
- 11 203.208.232.57 (203.208.232.57) 83.972 ms
- 12 *
- 13 *
- 14 *
- 15 *
- 16 *
- 17 *
- 18 *
- 19 *
- 20 *
- 21 *
- 22 *
- 23 *
- 24 *
- 25 *
- 26 *
- 27 *
- 28 *
- 29 *
- 30 *
現(xiàn)在看看tcptraceroute:
- [root@soft ~]# tcptraceroute -f 1 www.singtel.com.sg
- Selected device eth0, address 61.51.18.130, port 34733 for outgoing packets
- Tracing the path to www.singtel.com.sg (203.208.248.10) on TCP port 80 (http), 30 hops max
- 1 61.51.18.1 2.512 ms 1.543 ms 1.783 ms
- 2 202.96.13.169 1.548 ms 11.025 ms 6.981 ms
- 3 202.106.192.157 7.470 ms 8.355 ms 4.358 ms
- 4 219.158.4.65 4.590 ms 5.006 ms 2.284 ms
- 5 219.158.4.66 26.886 ms 30.142 ms 25.995 ms
- 6 219.158.3.198 28.820 ms 26.171 ms 28.981 ms
- 7 203.208.151.17 92.619 ms 92.521 ms 96.665 ms
- 8 GigabitEthernet6-0.sngtp-ar2.ix.singtel.com (203.208.183.19) 98.351 ms 97.487 ms 97.133 ms
- 9 202.160.250.226 83.047 ms 83.592 ms 83.252 ms
- 10 203.208.232.50 91.092 ms 90.978 ms 91.000 ms
- 11 203.208.232.57 83.049 ms 82.607 ms 82.000 ms
- 12 203.208.248.10 [open] 83.971 ms 82.609 ms 84.863 ms
- _____________________________________完成TRACEROUTE
五、補(bǔ)充:route的配置靜態(tài)路由表Linux
route命令主要用于手動(dòng)配置靜態(tài)路由表
- #route add net remote_net_ip gateway_ip 1
例:增加一條通過(guò)網(wǎng)關(guān)到達(dá)令一子網(wǎng)的路由
其中add代表要增加路由,net表示路由到達(dá)的是一個(gè)網(wǎng)絡(luò)而不是一臺(tái)主機(jī),1代表遠(yuǎn)端網(wǎng)絡(luò)需通過(guò)網(wǎng)關(guān)才能到達(dá)
(直接通過(guò)網(wǎng)絡(luò)接口相連時(shí),該參數(shù)用0)
命令格式:
- #route add -net remote_net_ip gateway_ip -netmask netmask
- #route add -host host_ip local_interface_ip -interface
六、HPING
1、下載hping 源代碼包
wget http://www.hping.org/hping3-20051105.tar.gz
2、安裝幫助文檔,仔細(xì)看看,在LINUX./BSD的環(huán)境下完成;
- Linux
- -----
- please, follows this steps:
- $ ./configure (first try ./configure --help)
- $ vi Makefile (optional)
- $ make
- $ su
- # make install
- FreeBSD, OpenBSD, NetBSD
- ------------------------
- You will need the libpcap and the gmake utility installed on your system.
- $ ./configure
- $ gmake
- $ su (or calife)
- # gmake install
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- NOTE: You should take care about your net/bpf.h file installing on
- BSD systems (specially with OpenBSD). If your original bpf.h was
- overwritten with the libpcap one probably hping will not work
- with over some interface.
- For example if you use the libpcap bpf.h on OpenBSD hping will
- not work over PPP interfaces.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3、正式完成,加載LIBPCAP
- [root@soft hping3-20051105]# ./configure --prefix=/usr/local/hping --with-libpcap=/usr/local/libpcap
- make;make install
七、其他