Recently in Computer networking Category
Die Bash eignet sich neuerdings auch als rudimentären Netcat-Ersatz. Um die Zeit von time.nist.gov port 13 auszulesen, genügt der folgende Befehl:
pb@titania:~$ cat </dev/tcp/time.nist.gov/13
55675 11-04-24 09:10:50 50 0 0 0.0 UTC(NIST) *
Einen HTTP-GET Request kann man z.B. wie folgt absetzen:
pb@titania:/dev$ exec 5<>/dev/tcp/comp.buetow.org/80
pb@titania:/dev$ echo -e "GET / HTTP/1.0\n" >&5
pb@titania:/dev$ cat <&5
HTTP/1.1 301 Moved Permanantly
Date: Sun, 24 Apr 2011 08:22:21 GMT
Server: Apache/2.2.17 (FreeBSD) mod_ssl/2.2.17 OpenSSL/0.9.8q DAV/2 PHP/5.3.5 with Suhosin-Patch SVN/1.6.16 mod_perl/2.0.4 Perl/v5.10.1
Set-Cookie: session=006059f2c8c6778c17dae9e5dfad755d; domain=; path=/
Location: http://www.buetow.org
Content-Length: 0
Connection: close
Content-Type: text/plain
Allerdings sollte man im Hinterkopf behalten, dass das Device /dev/tcp in echt gar nicht exisitert.
pb@titania:/dev$ ls | grep dev
pb@titania:/dev$
Die Bash interpretiert die Eingabe /dev/tcp einfach entsprechend. Aus meiner Sicht wäre es schöner, wenn es dafür ein separates Pseudo-Dateisystem gäbe. Sonst ist Verwirrung vorprogrammiert. So kann man vergeblich versuchen /dev/tcp/... innerhalb anderer Sprachen/Shells zu verwenden :)
A call to getaddrinfo(3) might return multiple answers. According to RFC 3484 these answers must be sorted so that the answer with the highest success rate is first in the list. The RFC provides an algorithm for the sorting. The static rules are not always adequate, though. For this reason the RFC also requires that system administrators get the chance to dynamically change the sorting. For the glibc implementation this can be achieved with the /etc/gai.conf file.
label ::1/128 0 label ::/0 1 label 2002::/16 2 label ::/96 3 label ::ffff:0:0/96 4 precendence ::1/128 50 precendence ::/0 40 precendence 2002::/16 30 precendence ::/96 20 precendence ::ffff:0:0/96 10
Ich hatte bereits erwähnt, dass die Xen-Skripte gepatched werden müssen, sofern man unter Debian Lenny in den DomUs (Xen) IPv6 benutzen will. In Dom0 muss dafür, sofern man IPv6 routen möchte, folgendes Skript wie folgt patchen (nochmal auf CXG gepasted):
admin@jupiter:/etc/xen/scripts$ diff -u ../scripts.bak/vif-route vif-route
--- ../scripts.bak/vif-route 2010-12-12 12:06:05.000000000 +0100
+++ vif-route 2010-12-19 12:24:53.000000000 +0100
@@ -23,12 +23,24 @@
dir=$(dirname "$0")
. "$dir/vif-common.sh"
+is_ipv6 () {
+ echo "$1" | perl -wane '/:/ && print "yes"'
+}
+
+echo Foo
+
main_ip=$(dom0_ip)
+main_ip6=2a01:4f8:100:32e3::2
case "$command" in
online)
ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up
echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
+ if [ ! -z "${main_ip6}" ]; then
+ ip -6 addr add ${main_ip6} dev ${vif}
+ echo 1 >/proc/sys/net/ipv6/conf/${vif}/proxy_ndp
+
+ fi
ipcmd='add'
cmdprefix=''
;;
@@ -39,13 +51,19 @@
;;
esac
-if [ "${ip}" ] ; then
- # If we've been given a list of IP addresses, then add routes from dom0 to
- # the guest using those addresses.
- for addr in ${ip} ; do
- ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
- done
-fi
+if [ "${ip}" ] ; then
+ # If we've been given a list of IP addresses, then add routes from dom0 to
+ # the guest using those addresses.
+ for addr in ${ip} ; do
+ result=$(is_ipv6 "${addr}")
+ if [ -z "${result}" ] ; then
+ ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
+ else
+ ${cmdprefix} ip -6 route ${ipcmd} ${addr} dev ${vif} src ${main_ip6}
+ ${cmdprefix} ip -6 neighbor ${ipcmd} proxy ${addr} dev eth0
+ fi
+ done
+fi
handle_iptable
Anschliessend besteht die Möglichkeit IPv6 Adressen der DomUs in den jeweiligen DomU Konfigurationsdateien festzulegen:
admin@jupiter:/etc/xen$ grep vif serv02.cfg vif = [ 'ip=188.40.57.245,mac=00:16:3E:A0:AA:FB', 'ip=2a01:4f8:100:32e3:2::2,mac=00:16:3E:A0:AA:FC' ]
Unter der Adresse http://ipv6test.buetow.org besteht von nun an die Möglichkeit die eigene IPv4 und IPv6 Konnektivität zu testen. Das unterliegende Skript ist ein quick-n-dirty Perl-hack welches über 3 verschiedene Hosts (ein Host mit einer IPv4 Adresse, ein host mit einer IPv6 Adresse und ein dritter Host mit beiden Adressen) angesprochen wird und neben Client- und Serveradressen herausfindet welche Protokollversion verwendet wird sowie einige DNS lookups mittels host und dig startet.
Have a lot of fun!
Alle Services (SMTP, POP3, IMAP) und auch alle Web-Services
(phpMyAdmin, RoundCube Webmail, ...) werden nun auch Dualstacked
betrieben. Neben IPv4 funktionieren nun also auch IPv6 Zugriffe.
Jetzt müsste ich nurnoch IPv6 zuhause (DSL) haben.... Evtl. werde ich mir einen IPv6 over IPv4 Tunnel mittels OpenVPN dafür basteln.
Mittlerweile können auch alle meine Linux Xen DomUs natives IPv6. Vorher konnten dies nur meinte Dom0s und FreeBSD Jails. Somit sind alle Webfrontends unter *.buetow.og (u.A. RoundCube Webmail, PHPMyAdmin, Mailman, RT, IDS, dieser Blog, Nagios.... etc) mit einem AAAA Record ausgestattet und ansprechbar. Dafür musste unter Debian Lenny Dom0-Seitig das Xen-Script vif-route gepatched werden.
Seit heute unterstützt mein Shell-Server saturn.buetow.org (FreeBSD) inklusive seiner Jails (u.A. titan.buetow.org) natives IPv6. Jeder Kunde kann bei Bedarf sein eigenes /16 IPv6 Subnetz kostenlos bekommen.
Seit etwas längerer Zeit hat bereits jupiter.buetow.org (Linux Dom0) nativen IPv6 Support. Die DomUs müssen allerdings noch dafür konfiguriert werden.
Ping6 von jupiter.buetow.org auf titan.buetow.org:
pb@jupiter:~$ ping6 2a01:4f8:100:7263:bad:dead:beef:babe PING 2a01:4f8:100:7263:bad:dead:beef:babe (2a01:4f8:100:7263:bad:dead:beef:babe) 56 data bytes 64 bytes from 2a01:4f8:100:7263:bad:dead:beef:babe: icmp_seq=1 ttl=62 time=0.172 ms 64 bytes from 2a01:4f8:100:7263:bad:dead:beef:babe: icmp_seq=2 ttl=62 time=0.156 ms 64 bytes from 2a01:4f8:100:7263:bad:dead:beef:babe: icmp_seq=3 ttl=62 time=0.163 ms ^C --- 2a01:4f8:100:7263:bad:dead:beef:babe ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1999ms rtt min/avg/max/m
An introduction to VLANs and VLAN trunking, how Linux interacts with VLANs and how you might use them in networks.
To begin, we must have a more formal definition of what a LAN is. LAN stands for local area network. Hubs and switches usually are thought of as participating in a single LAN. Normally, if you connect two computers to the same hub or switch, they are on the same LAN. Likewise, if you connect two switches together, they are both on the same LAN....
Read more @ Linux Journal

