分类:
2007-07-21 14:57:38
search name-of-domain.com - Name of your domain or ISP's domain if using their name server nameserver XXX.XXX.XXX.XXX - IP address of primary name server nameserver XXX.XXX.XXX.XXX - IP address of secondary name server Ex: nameserver 135.252.44.227 Note: for DHCP, this file will be loaded automatically.
127.0.0.1 your-node-name.your-domain.com localhost.localdomain localhost XXX.XXX.XXX.XXX node-name Ex: 127.0.0.1 localhost.localdomain localhost 135.252.142.150 qdcvs.gdc.lucent.com
Red Hat network configuration file used by the system during the boot process.
hosts: files dns nisplus nis This example tells Linux to first resolve a host name by looking at the local hosts file (/etc/hosts), then if the name is not found look to your DNS server as defined by /etc/resolv.conf and if not found there look to your NIS server. In the past this file has had the following names: /etc/nsswitch.conf, /etc/svc.conf, /etc/netsvc.conf, ... depending on the distribution.
Configuration settings for your first ethernet port (0).
/sbin/ifconfig eth0 192.168.10.12 netmask 255.255.255.0 broadcast 192.168.10.255 note: ifconfig command does NOT store this information permanently.
1. /etc/sysconfig/network For static IP configuration NETWORKING=yes HOSTNAME=my-hostname - Hostname is defined here and by command hostname FORWARD_IPV4=true - True for NAT firewall gateways and linux routers. GATEWAY="XXX.XXX.XXX.YYY" - Used if your network is connected to another network or the internet. for DHCP client configuration: NETWORKING=yes HOSTNAME=my-hostname - Hostname is defined here and by command hostname 2. /etc/sysconfig/network-scripts/ifcfg-eth0 Static IP address configuration: DEVICE=eth0 BOOTPROTO=static BROADCAST=XXX.XXX.XXX.255 IPADDR=XXX.XXX.XXX.XXX NETMASK=255.255.255.0 NETWORK=XXX.XXX.XXX.0 ONBOOT=yes DHCP client configuration: DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcp note: use /sbin/ifup to bring interface(such as eth0) up. /sbin/ifdown bring interface down.
Ex: route -e Show routing table route add -host 123.213.221.231 eth1 Access individual computer host specified via network interface card eth1: route add -net 10.13.21.0 netmask 255.255.255.0 gw 192.168.10.254 eth0 Access ISP network identified by the network address and netmask using network interface card eth0. route del -net 10.13.21.0 netmask 255.255.255.0 gw 192.168.10.254 eth0 Specify default gateway to use to access remote network via network interface card eth0. route add default gw 201.51.31.1 eth0
/etc/rc.d/init.d/network start - command to start, restart or stop the network netstat - Display connections, routing tables, stats etc netstat -punta - List externally connected processes: netstat -nap - List all connected processes: netstat -s - Show network statistics netstat -a -i eth0 - Kernel interface table info ping - send ICMP ECHO_REQUEST packets to network hosts. traceroute - print the route packets take to network host traceroute IP-address-of-server traceroute domain-name-of-server whois - Lookup a domain name in the internic whois database. finger - Display information on a system user. iptables - IP firewall administration host - Give a host name and the command will return IP address. nslookup - Give a host name and the command will return IP address. The following firewall rules will drop ICMP requests. Iptables: iptables -A OUTPUT -p icmp -d 0/0 -j DROP Ipchains: ipchains -A output -p icmp -d 0/0 -j DENY Drop all incomming pings: echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all nmap - Network exploration tool and security scanner List pingable nodes on network: nmap -sP 192.168.0.0/24 Scans network for IP addresses 192.168.0.0 to 192.168.0.255 using ping. tcpdump - dump traffic on a network. tcpdump tcp port 80 and host server-1 tcpdump ip host server-1 and not server-2 note: use tcpdump must put interface to promisc mode. ifconfig eth0 promisc cancel promisc mode ifconfig eth0 -promisc chkconfig -list to view all system services and their st