Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

Netzwerke und Netzwerktools Franz Schäfer LV Linux: Effiziente Anwendung anhand von Fallbeispielen.

Ähnliche Präsentationen


Präsentation zum Thema: "Netzwerke und Netzwerktools Franz Schäfer LV Linux: Effiziente Anwendung anhand von Fallbeispielen."—  Präsentation transkript:

1 Netzwerke und Netzwerktools Franz Schäfer LV Linux: Effiziente Anwendung anhand von Fallbeispielen

2 Franz Schäfer ● Sysadmin @ IST. Austria ● Sysadmin @ ZID WU ● ISP (akis, silverserver,...) ● Nachtrichtentechnik, Regelungstechnik, Computertechnik ● Linux User seit 1995 (kernel 1.1.18)

3 Netzwerkgrundlagen ● Physische Verbindung – Ethernet, UTP, Wireless ("broadcast") – Serielles Kabel, Tunnel (Virtuell) ("point to point") ● Interface ● Netzwerkstack (z.B.: TCP/IP) ● Applikation (z.B.: Web-Browser )

4 ISO-OSI Modell

5 ifconfig # ifconfig eth0 Link ap:Ethernet HWaddr 00:0E:2E:6C:BD:51 inet addr:213.138.17.51 Bcast:213.138.17.127 Mask:255.255.255.128 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:52213283 errors:0 dropped:0 overruns:0 frame:0 TX packets:23052987 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:273284968 TX bytes:472122977 Interrupt:10

6 ifconfig ● Anzeige der (aktiven) Netzwerkinterfaces ● Details zu den Interfaces – MAC Adresse – IP Adresse – Eingehende, Ausgehende Packete ● Veränderung der Interface-Einstellungen

7 Exkurs Ethernet ● Mehrere Netzwerkknoten “sehen” sich direkt ● Addressierung über MAC-Addresse – z.B.: A3:07:56:3C:F3:02 ● Broadcasts (“an alle”) möglich Switch oder Hub

8 TCP/IP (v4) ● 2^32 Adressen: geschrieben als 256^4 in Notation: – z.B.: 113.251.19.71 – Keine gültige Adresse: 64.311.17.92 ● Auf Ethernet: Zuordnung zwischen MAC- Addressen und IP Addressen via arp (address resolution protocol) – Befehl: arp -n

9 Einschub IPv6 # host -t AAAA www.ipv6.org 2001:6B0:1:EA:202:A5FF:FECD:13A6 128 bit adressen geschrieben als 8 mal 4hex stellen. Tools: ping6, traceroute6, "ip -6" ● native vs. tunnel ● 6to4 tunnel 2002:

10 Ipv6 vor und nachteile ● noch wenige hosts native v6 erreichbar. ● /48 für endkundInnen ● privacy?

11 CIDR ● Classless Internet Domain Routing ● 123.24.67.0/24 = 123.24.67.XXX ● 137.208.0.0/16 = WU-Netz = 137.208.xxx.xxx ● 123.24.67.128/25 =123.24.67.128 bis 123.24.67.255 ● Alternativ: Netmask: 255.255.255.128

12 Exkurs: Private IP Space ● 10.0.0.0 – 10.255.255.255 – 10.0.0.0/8 oder = 65536 mal /24 ● 172.16.0.0 – 172.31.255.255 – 172.16.0.0/12 = 1024 mal /24 ● 192.168.0.0 – 192.168.255.255 – 192.168.0.0/16 = 256 mal /24 ● Beispiel: Heimnetz: – 192.168.1.13/24 ● Nicht im Internet geroutet => NAT

13 alias interface # ifconfig eth0:2 192.168.201.42 \ netmask 255.255.255.0 \ broadcast 192.168.201.255

14 tcpdump – traffic ansehen tcpdump -ni eth0 not port 22 13:40:09.295326 IP 213.235.242.217.4569 > 193.238.157.20.4569: UDP, length 12 13:40:09.322544 IP 141.89.64.1.27650 > 193.238.157.20.53: 16832% [1au] AAAA? dns.mond.at. (40) 13:40:09.322785 IP 193.238.157.20.53 > 141.89.64.1.27650: 16832* 0/1/1 (88) 13:40:09.483043 arp who-has 192.168.30.32 (ff:ff:ff:ff:ff:ff) tell 192.168.30.32 13:40:09.516130 IP 194.168.8.110.32771 > 193.238.157.20.53: 57265 MX? area23.mond.at. (32)

15 ping # ping www.google.com PING www.l.google.com (209.85.135.147) 56(84) bytes of data. 64 bytes from mu-in-f147.google.com (209.85.135.147): icmp_seq=1 ttl=241 time=22.6 ms 64 bytes from mu-in-f147.google.com (209.85.135.147): icmp_seq=2 ttl=241 time=22.6 ms

16 traceroute traceroute www.google.com traceroute to www.l.google.com (209.85.135.103), 30 hops max, 40 byte packets 1 gw-2-254.wu-wien.ac.at (137.208.254.254) 0.793 ms 0.769 ms 0.752 ms 2 box-1-19.wu-wien.ac.at (137.208.19.135) 0.849 ms 0.810 ms 0.879 ms... 14 mu-in-f103.google.com (209.85.135.103) 23.536 ms 23.664 ms 23.336 ms

17 route - wie die packete ihren weg finden route = Wegweiser für IP-Netze 192.168.1.0/24 192.168.2.37 192.168.2.0/24 192.168.2.1 192.168.1.94 192.168.1.7 192.168.1.0/24 erreichbar via 192.168.2.1 192.168.1.0/24 erreichbar via 192.168.2.1

18 route beispiele # route -n # route add default gw 192.168.1.1 # route add -net 192.168.2.0/24 \ gateway 192.168.1.7

19 ip forwarding einschalten ● default i.a.: packete nicht weiterleiten + spoof protection ● in /etc/sysctl.conf net.ipv4.ip_forward=1 net.ipv4.conf.all.rp_filter=1 ● oder echo 1 > /proc/sys/net/ipv4/ip_forward echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter

20 dhcp ● server: vergibt IP adressen, routen, nameserver ● client: holt sich alles was gebraucht wird # dhclient eth0 (alte distribution # pump eth0)

21 ifup / ifdown # ifup eth1 # ifup -a datei: /etc/network/interfaces auto lo iface lo inet loopback auto eth1 iface eth1 inet dhcp

22 /etc/network/interfaces auto eth0 iface eth0 inet static address 192.168.17.42 network 192.168.17.0 netmask 255.255.255.0 broadcast 192.168.17.255 gateway 192.168.17.1 up /root/myfirwall.sh

23 troubleshooting step by step ● ifconfig eth0 – funktioniert? – modprobe – wireless: iwconfig, wpa_supplicant ● IP addressen im ifconfig richtig? – dhclient, pump ● route -n richtig?

24 troubleshooting part2 ● ifconfig zeigt eingehende packete? ● tcpdump -ni zeigt packete? ● ping auf lokalen rechner (am besten gateway) ist möglich? ● arp -n zeigt Mac Addresse des gateways? ● dns problem (name statt IP)

25 TCP, UDP, Port Nummern ● TCP – Verbindungsorientiert ● UDP – Einzelne (Datagram) packete ● Jedes Service hat ein Port: – wie die Türnummer zu einer Hausnummer – 80 www (http) – 25 mail (smtp)

26 Portnummern, netstat ● Ports: – 21 ftp – 22 ssh – 23 telnet – 80 http ● welche ports sind offen? – # netstat -nt --listen -p – # netstat -nu --listen -p

27 Beispiel: ADSL Verbindung in /etc/network/interfaces iface eth0 inet static address 10.0.0.140 netmask 255.255.255.0 testen mit # ping 10.0.0.138 10.0.0.140 (computer) zu 10.0.0.138 (adsl modem)

28 ADSL Verbindung pptp ● in /etc/ppp/peers/meinprovider user LoginNameZumProvider noauth noipdefault defaultroute persist maxfail 0 noproxyarp pty "/usr/sbin/pptp 10.0.0.138 – nolaunchpppd" ● in /etc/ppp/pap-secrets LoginNameZumProvider * PassWort Verbinden: /usr/sbin/pppd call meinprovider

29 ADSL P-t-P Interface # ifconfig zeigt nun: ppp0 Link encap:Point-to-Point Protocol inet addr:82.49.160.41 P-t-P:192.168.100.1 Mask:255.255.255.255.... debuging: in config file “debug” schreiben und / var/log/syslog, /var/log/messages oder /var/log/debug mittels tail -f anschauen

30 Zusammenfassung – ISO-OSI Modell – ifconfig – Ethernet – TCP/IP – CIDR – Private Space IP – alias Interface – tcpdump – ping – traceroute – route – dhcp – ifup /ifdown – troubleshooting – TCP, UDP, Portnummern – Beispiel ADSL PtP

31 Nützliche Links http://mond.at/cd/ http://tldp.org/HOWTO/NET3-4-HOWTO.html http://www.linuxhaven.de/ dlhp/HOWTO/DE-Netzwerk-HOWTO.html

32 Mögliche Vertiefungen ● iptables – firewalling, NAT ● dynamisches routing ● VLANs ●...

33 iptables aufbau

34 iptables - übersicht # iptables -L -n # iptables -L -n -t nat anzeigen der tables # iptables -F flush # iptables -I INPUT -j DROP -i eth1 -p tcp --dport 22 -s 0/0 # iptables -I INPUT -j ACCEPT -s 182.16.21.0/24 -p tcp --dport 22 sperre aller zugriffe auf ssh ausser von einem netz

35 iptables nat # iptables -t nat -I POSTROUTING -j SNAT \ -s 10.0.0.0/8 -d ! 10.0.0.0/8 \ --to-source 123.231.12.222 # iptables -t nat -I POSTROUTING \ -j MASQUERADE -s 192.168.1.0/24 \ --out-interface eth1

36 dynamisches routing ● intern: RIP, OSPF ● extern (zwischen providern): BGP linux software: ● quagga ● zebra ● bird

37 VLANs problem: mehrere unabhaengige netze am selben kabel (z.b. verbindung von switchen oder servern die in viele LANs "sehen" wollen) Trunk port: 12 bit (4096) VLAN id in ethernet packet. IEEE 802.1q

38 VLAN tagged vs. untagged

39 linux vlan commands # ifconfig eth0 up # vconfig add eth0 101 # vconfig add eth0 201 # ifconfig eth0.101 \ 192.168.123.45..


Herunterladen ppt "Netzwerke und Netzwerktools Franz Schäfer LV Linux: Effiziente Anwendung anhand von Fallbeispielen."

Ähnliche Präsentationen


Google-Anzeigen