[[http://tmade.de|Home tmade.de]] [[http://wiki.tmade.de|Home Wiki]] ===== Network ===== ==== Configure ==== Netzwerk/ IP change (opensuse /SLES): /etc/sysconfig/network/ifcfg-eth0 === Commandline Configuration === Temporary networking modification via ifconfig/ route: ifconfig eth0 172.22.49.127 netmask 255.255.255.0 ifconfig eth0:0 192.168.0.5 netmask 255.255.255.0 #add temporary a 2nd ip-adress ifconfig eth0:1 192.168.0.6 netmask 255.255.255.0 #add temporary a 3nd ip-adress route add default gw 172.22.49.2 route del default gw 192.168.1.1 netmask 0.0.0.0 route add -host hostname.domain gw 192.168.1.1 route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0 route add -net 192.168.30.0 netmask 255.255.255.0 gw 192.168.30.2 route add -host 192.168.0.1 dev ippp0 route del -host 192.168.0.1 route add default gw 192.168.0.1 ==="ip" command=== ip a #show running interface(s) configuration ip addr add 10.0.2.15/24 dev enp0s3 #temporary set ip to interface "enp0s3" sudo ip link set enp0s3 down #interface "enp0s3" down sudo ip link set enp0s3 up #interface "enp0s3" up sudo ip route add default via 10.0.2.2 #temporary set default gateway ===Config=== === Commandline Configuration IP command === ip address show #like ifconfig ifconfig etho 192.168.63.73 netmask 255.255.255.0 ip addr list dev eth0 #list all IP´s for eth0 - also virtual ones!! Example: ip address add 192.168.63.73/24 brd + dev eth0 Config will be saved to: /etc/sysconfig/network/ifcfg-eth0 === Example(dhcp) === BOOTPROTO='dhcp' #or static BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='' #assigned if static e.g. 10.6.7.203 MTU='' NAME='AMD PCnet - Fast 79C971' NETMASK='' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto' UNIQUE='rBUF.weGuQ9ywYPF' USERCONTROL='no' _nm_name='bus-pci-0000:02:01.0' === Example(static IP) === BOOTPROTO='static' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='10.6.7.203' MTU='' NAME='AMD PCnet - Fast 79C971' NETMASK='255.255.255.0' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto' UNIQUE='rBUF.weGuQ9ywYPF' USERCONTROL='no' _nm_name='bus-pci-0000:02:01.0' === Additional IP Example === BOOTPROTO='dhcp' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='' MTU='' NAME='AMD PCnet - Fast 79C971' NETMASK='' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto' UNIQUE='rBUF.weGuQ9ywYPF' USERCONTROL='no' _nm_name='bus-pci-0000:02:01.0' IPADDR_tomaddip='10.6.7.220' NETMASK_tomaddip='255.255.255.0' LABEL_tomaddip='tomaddip' === Configuration network interface in SLES === This file contains the network interfaces and their assigned MAC adresses /etc/udev/rules.d/30-net_persistent_names.rules or /etc/udev/rules.d/70-persistent-net.rules === Route === To change the default route permanently edit "/etc/sysconfig/network/routes" such as: default 192.168.63.1 - - === RHEL === Edit on command line the file /etc/sysconfig/network as follows: NETWORKING=yes NETWORKING_IPV6=yes HOSTNAME=wan.nixcraft.in GATEWAY=74.86.49.129 Additionally edit /etc/sysconfig/network-scripts/ifcfg-eth0: # Intel Corporation 82573E Gigabit Ethernet Controller (Copper) DEVICE="eth0" BOOTPROTO="static" HWADDR="00:30:48:56:A6:2E" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" IPADDR=192.168.1.2 NETMASK=255.255.255.0 === Ubuntu === The following config (/etc/network/interfaces) shows a bonding interface (eth0, eth2) and a third networkdevice configuration (eth1): # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto bond0 iface bond0 inet static address 192.168.64.127 netmask 255.255.255.0 network 192.168.64.0 broadcast 192.168.64.255 gateway 192.168.64.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.63.4 192.168.63.8 dns-search my-domain.local #slaves eth0 eth2 #bond_mode 0 #bond_miimon 100 #bond_updelay 200 #bond_downdelay 200 post-up ifenslave bond0 eth0 eth2 pre-down ifenslave -d bond0 eth0 eth2 #iSCSI Network Interface auto eth1 iface eth1 inet static address 192.168.254.55 netmask 255.255.254.0 network 192.168.254.0 broadcast 192.168.254.255 # gateway 192.168.254.1 # dns-* options are implemented by the resolvconf package, if installed DHCP: auto eth0 iface eth0 inet dhcp ==== Test ==== === Ethtool === ethtool eth0 #Show specifications of device "eth0" ethtool -t eth0 ethtool -i eth0 See also: http://www.nwlab.net/tutorials/ethtool/ethtool.html === Tcpdump === tcpdump -i eth0 tcpdump -niany tcpdump -i eth0 -s 65535 -w tracefile #Create dump, which can be imported in wireshark tcpdump -i eth0:0 -s 65535 -w tracefile.`date +%d.%m.%Y.%H.%M.%S` tcpdump -i eth1 -s 84 -w tracefile.`date +%d.%m.%Y.%H.%M.%S` #dump just header files tcpdump -i eth1 -qtln icmp === IPERF === Start server: (chmod +x iperf) ./iperf -s Client: iperf.exe -c 192.168.xxx.xxx -i5 -t 300 iperf3.exe -c 192.168.20.2 -i5 -t300 === Telnet === Telnet is a very good tool to test open ports. telnet localhost 25 telnet IP 25 telnet 192.168.0.20 25 echo quit | telnet 192.168.1.1 22 | grep –i connected If there´s no telnet: nc -zv 192.168.0.20 25 Or: echo >/dev/tcp/localhost/25 echo >/dev/tcp/192.168.0.20/25 === Mails with telnet === ehlo testmail.org (Identify and demand SMTP-Modus) mail from: (Sender) rcpt to: (Receiver) data (Enable to write an EMail) . (Terminate insert-Mode) quit (Terminate session) Tip: reset (enables to send additionally emails) ===curl=== curl -v -H "Host: my-server.mydomain.com" 127.0.0.1:8443 #test connectivity locally on host to simulate external access curl -X GET https://my-domain.de:6443 #check if port is open curl --noproxy "*" http://localhost:8080 #check if port is open === jmeter (performance tests) === === General === NLB #Network Load Balancing LACP #Link Aggregation Control Protocol (LACP) STACKING #Join logical switches over a special connection (high speed) to one switch with more ports