basic tcp/ip networking - computaci³n afyanez/docencia/2017/grado/aso-3-   192.168.1.99

Download Basic TCP/IP networking - Computaci³n afyanez/Docencia/2017/Grado/ASO-3-   192.168.1.99

Post on 19-Oct-2018

213 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Basic TCP/IP networkingGrado en Informatica 2016/2017Departamento de Computacion

    Facultad de InformaticaUniversidad de Coruna

    Antonio Yanez Izquierdo

    Antonio Yanez Izquierdo Basic TCP/IP networking 1 / 77

  • Contents I

    1 Basic network configurationsolaris 10solaris 11openbsdFreeBSDdebian linuxfedora linuxubuntu and devuan linuxlinux: Interaccion con Network Manager

    2 Routes

    3 Network interface aliasing

    4 inetd configurationtcpwrappersinetd and tcpwrappers in Solaris

    Antonio Yanez Izquierdo Basic TCP/IP networking 2 / 77

  • Basic network configuration

    Basic network configuration

    Antonio Yanez Izquierdo Basic TCP/IP networking 3 / 77

  • Basic network configuration

    basic IP v4 configuration

    to properly configure a machine using ipv4 we have to configure

    the machine namethe Network Interface Cardsthe routesthe dns (if using it)

    Antonio Yanez Izquierdo Basic TCP/IP networking 4 / 77

  • Basic network configuration

    basic NIC configuration

    The bassic things we have to configure for a Network Interface Cardare

    its ip addressits netmask (number of bits in its ip address that correspond tonetwork address)its broadcast address

    Antonio Yanez Izquierdo Basic TCP/IP networking 5 / 77

  • Basic network configuration

    ways to configure the network

    there are two ways to configure the network

    manual configuration: we configure manually each of the paramaters,either directly using the comand line or through the boot scriptsusing dhcp: the network interface card asks for its configuration to amachine in the network (the dhcp server). This can be done directlythrough the comand line or using the boot scripts

    most systems have a graphic utility to configure the network, whichcan be used to configure either manually or via dhcp. We wont dealwith those utilities, neither will we deal with the wireless configurationoptions

    Antonio Yanez Izquierdo Basic TCP/IP networking 6 / 77

  • Basic network configuration

    ifconfig

    the comand ifconfig configures network interfaces,

    it is usually located at /sbin/ifconfig

    it can configure interfaces both manually or using dhcp

    ifconfig -a shows the actual configuration of the Network InterfaceCards

    Antonio Yanez Izquierdo Basic TCP/IP networking 7 / 77

  • Basic network configuration

    configuring the dns

    the configuration of the dns resides on the file /etc/resolv.conf

    this file has the options to the resolver configuration. The mostcommon options are

    nameserver to specify the address of a domain name server, up to 3can be defineddomain (optional) to sepecify the local domain. Short names aresupposed to be from this domain

    example of /etc/resolv.conf file

    domain dc.if.udc.es.

    nameserver 193.144.51.10

    nameserver 192.144.48.30

    Antonio Yanez Izquierdo Basic TCP/IP networking 8 / 77

  • Basic network configuration

    the /etc/hosts file

    this file contains the locally defined ip addresses of hosts

    its format is

    ip_address host_name aliases

    example of /etc/hosts

    127.0.0.1 localhost

    192.168.1.99 abyecto.dc.fi.udc.es abyecto

    Antonio Yanez Izquierdo Basic TCP/IP networking 9 / 77

  • Basic network configuration

    the /etc/nsswitch.conf file

    this file is used to determine the sources from where to obtainname-service information of several categories: hosts, users, mailaliases . . .

    it also specifies the order in which this sources of information shouldbe queried

    in the following example, the hosts ips are first searched for in thelocal files, then the dns is queried

    passwd: compat

    group: compat

    shadow: compat

    hosts: files dns

    networks: files

    Antonio Yanez Izquierdo Basic TCP/IP networking 10 / 77

  • Basic network configuration solaris 10

    Basic network configurationsolaris 10

    Antonio Yanez Izquierdo Basic TCP/IP networking 11 / 77

  • Basic network configuration solaris 10

    NIC configuration in solaris 10

    the interfaces are named after the driver in the kernel that managesthem.

    example: the kernel uses the e1000g driver for Intel(R) PRO/1000NICS. Cards of this type will get the names e1000g0, e1000g1 . . .

    ifconfig interface name plumb: plumbs (or connects) the interface:no configuration can be done before this, even ifconfig wont showthe interface until it is plumbed

    ifconfig interface name dhcp configures the card interface nameusing dhcp.

    Antonio Yanez Izquierdo Basic TCP/IP networking 12 / 77

  • Basic network configuration solaris 10

    NIC configuration in solaris 10

    ifconfig interface name inet addr netmask netm broadcastbcast configures the card interface name with address addr,netmask netm and broadcast address bcast. If omitted broadcastdefaults to using 1s in the host number. The netmask can also bespecified in the format address/network bits, or can be specifiedthrough one of the netwroks defined in /etc/networks#ifconfig e1000g1 inet 192.168.1.100 netmask 255.255.255.0

    #ifconfig e1000g1 inet 192.168.1.100/24

    ifconfig interface name up brings the interface up

    Antonio Yanez Izquierdo Basic TCP/IP networking 13 / 77

  • Basic network configuration solaris 10

    NIC configuration in solaris 10 at boot time

    if we want to get the interfaces automatically configured at boot time(via svc:/network/physical) well use the following files

    interfaces using dhcp

    /etc/hostname.interface name: empty file to plumb the interface/etc/dhcp.interface name: empty file to get the interface configuredwith dhcp

    Antonio Yanez Izquierdo Basic TCP/IP networking 14 / 77

  • Basic network configuration solaris 10

    NIC configuration in solaris 10 at boot time

    interfaces configured manually

    /etc/hostname.interface name: file containing the necessaryparameters passed to ifconfig to configure the interface. The inetparameter is omitted: should we want to configure an inet6 interfacewe would use an /etc/hostname6.interface name file

    # cat /etc/hostname.e1000g1

    192.168.1.100 netmask 255.255.255.0

    #

    Antonio Yanez Izquierdo Basic TCP/IP networking 15 / 77

  • Basic network configuration solaris 10

    NIC configuration in solaris 10 at boot time

    /etc/nodename: contains the name of the system. It is neccessary ifthe system is configured via dhcp if the DHCP server does not providea value for the hostname. The system can also get the name from the/etc/hosts database using the ip from the primary network card

    /etc/defaultrouter: the ip address (or name if defined in/etc/hosts) of the default router.

    /etc/defaultdomain: a single line containing a hosts domain name

    /etc/networks: used to associate network names to networkaddresses

    Antonio Yanez Izquierdo Basic TCP/IP networking 16 / 77

  • Basic network configuration solaris 11

    Basic network configurationsolaris 11

    Antonio Yanez Izquierdo Basic TCP/IP networking 17 / 77

  • Basic network configuration solaris 11

    network configuration in Solaris 11

    Solaris 11 uses profile based network configuration. There are to NCP(Network Configuration Profiles): the DefaultFixed NCP and theAutomatic NCP.

    Additional profiles can be created by the system administrator

    we can switch between the profiles with the netadm command

    # netadm enable -p ncp DefaultFixed

    //to activate the DefaultFixed profile

    # netadm enable -p ncp Automatic

    //to activate the Automatic profile

    Antonio Yanez Izquierdo Basic TCP/IP networking 18 / 77

  • Basic network configuration solaris 11

    network configuration in Solaris 11

    in the DefaultFixed profile well use the commands dladm and ipadmto configure the network

    in the Automatic profile we use the commands netcfg and andnetadm to create and manage network configuration.

    netadm list shows the active NCP on the system

    changes made through these commands are persistent across reboots,so theres no need to deal with configuration files. Well deal onlywith the manual mode

    Antonio Yanez Izquierdo Basic TCP/IP networking 19 / 77

  • Basic network configuration solaris 11

    network configuration in Solaris 11

    network interfaces are created with the ipadm command.

    # ipadm create-ip net0

    network interfaces can be destroyed with:

    # ipadm delete-ip net0

    once created we can assign them an static ipv4 address# ipadm create-addr -T static -a 192.168.1.7/24 net0/addr

    or have them configured through dhcp

    # ipadm create-addr -T dhcp net0/addr

    Antonio Yanez Izquierdo Basic TCP/IP networking 20 / 77

  • Basic network configuration solaris 11

    network configuration in Solaris 11

    to disable one interface.

    # ipadm disable-if net0

    to see the addresses asigned to the interfaces

    # ipadm show-addr

    to see the status of the interfaces

    # ipadm show-if

    to see the physical properties of each datalink

    # dladm show-phys

    Antonio Yanez Izquierdo Basic TCP/IP networking 21 / 77

  • Basic network configuration solaris 11

    network configuration in Solaris 11

    to stablish the default route

    # route -p add default 192.168.2.1

    the dns is configured thorugh the services facilities

    # svccfg -s network/dns/client setprop \

    config/nameserver = net_address: 193.144.51.10

    as is the nswitch

    # svccfg -s name-service/switch setprop \

    config/host = astring: ("files dns")

    Antonio Yanez Izquierdo Basic TCP/IP networking 22 / 77