Table of Contents

Home 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 -host 192.168.0.1 dev ippp0
route del -host 192.168.0.1
route add default gw 192.168.0.1 

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

Additionally you can send Mails with it:

ehlo testmail.org (Identify and demand SMTP-Modus)
mail from:<test@testmail.org> (Sender)
rcpt to:<roehm@linux.de> (Receiver)
data (Enable to write an EMail)
.    (Terminate insert-Mode)
quit (Terminate session)

Tip:

reset (enables to send additionally emails)

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
linux/network.txt · Last modified: 2021/07/06 17:19 by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki