networking - centos · 09/01/2018 · • mandrake/mandriva: network and internet configuration...

23
Đặng Thanh Bình Networking - CentOS

Upload: vuduong

Post on 09-Oct-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Đặng Thanh Bình

Networking - CentOS

Contents

• Network configuration and information• Network configuration commands

NETWORK CONFIGURATION AND INFORMATION

Config Of Network Interfaces

• Ubuntu configuration is done selecting System->Administration->Networking.

• RedHat/CentOS: redhat-config-network– has both a graphical and a text mode interface.

• Mandrake/Mandriva: Network and Internet Configuration Wizard

• GNOME systems: gnome-network-preferences.• KDE systems: knetworkconf.

Network Interface Names

• lo or the local loop is linked with the internal 127.0.0.1 address

• eth0: a standard network interface card• ppp0: the modem

Network Configuration Files

• /etc/hosts

Network Configuration Files

• /etc/resolv.conf– Configure access to a DNS server

• /etc/nsswitch.conf– Define the order in which to contact different

name services. For Internet use, it is important that dns shows up in the "hosts" line:

Network Configuration Files

• /etc/sysconfig/network– Định nghĩa các cấu hình network cơ bản cho máy

tính.

enable networkenable network IPv6

tên máy tính

default gateway c a máy tínhủ

so sánh v i giá tr ớ ịtrong /etc/hosts

Network Configuration Files

• ifcfg-eth[n]– Each network card has a configuration file in

/etc/sysconfig/network-scripts/ifcfg-eth[n].– n: start from 0.– Loopback card config file ifcfg-lo

tên card m ngạgán IP tĩnh, ho c DHCPặ

active khi boot.

Network Configuration Files

• /etc/services– File /etc/services gồm một danh sách network port và

các service sử dụng những port này.– Khi định nghĩa một service mới, người quản trị phải

định nghĩa một cặp service name và port number vào file /etc/services.

– Port 0 – 1024: là những port đã được dành riêng.– Port > 1024: port được định nghĩa thêm vào tùy theo

nhu cầu của ứng dụng

NETWORK CONFIGURATION COMMANDS

ip command

• Assigning IP addresses to interfaces• Setting up routes to the internet and to other

networks• Displaying TCP/IP configurations• …

ip command

ifconfig command

• Displaying network interface information

ifconfig command

• Display details of all interfaces including disabled interfaces

# ifconfig -a• Disable an Interface

# ifconfig eth0 down• Enable an Interface

# ifconfig eth0 up

ifconfig command

• Assign ip-address to an Interface# ifconfig eth0 192.168.2.2

• Change Subnet mask of the interface eth0.# ifconfig eth0 netmask 255.255.255.0

• Change Broadcast address of the interface eth0.# ifconfig eth0 broadcast 192.168.2.255

• Assign ip-address, netmask and broadcast at the same time to interface eht0.

# ifconfig eth0 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255

ifconfig command

• Change MTU– MTU is the maximum number of octets the

interface is able to handle in one transaction– For Ethernet the Maximum transmission unit by

default is 1500

# ifconfig eth0 mtu NUMBER

ifup, ifdown command

• Lệnh ifup dùng để enable một interface.• Lệnh ifdown dùng để disable một interface.

netstat command

• Checking the host configuration• Routing information can be displayed with

the -nr option

• ip route show

host command

• Display information on hosts or domains

• Simlar to dig command

ping command

• To check if a host is alive

traceroute command

• Check the route that packets follow to a network host

• On some systems, traceroute has been renamed to tracepath

whois command

• Specific domain name information can be queried using the whois command