31 Mayıs 2012 Perşembe

Unix komutları -4

Network commands


Solaris
Red Hat
Ubuntu/Debian
HP
AIX
Basic network information 
  (hostname, ip address)
/etc/hostname.hme0
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/network/interfaces
/etc/rc.config.d/netconf
stores information in the ODM (Object Database Manager)
displaying network interfaces
prtdiag -v 
ifconfig -a
 

kstat hme:0
kstat e1000g:0
ifconfig
system-config-network (GUI)
ifconfig
ioscan -funC lan (list hardware) 
lanscan -v (list configured)
ifconfig lan0 (individual)
ifconfig -a

entstat -d <interface>

lsdev -Cc if
lsdev -Cc tcpip

odmget -q "name=en0" CuAt

lsattr -EHl en0
 
Configure network interface
ifconfig
ifconfig
ifconfig
ifconfig <interface>
mktcpip (completely setup a network interface)
rmtcpip (remove all network interfaces)
# configure an interface
mktcpip -h aix1 -a 192.168.1.200 -m 255.255.255.0 -i en1 -g 192.168.0.10

-h - hostname assigned to interface
-a - ip address
-m - netmask
-i - interface name
-g - gateway ip address
# remove an interface
ifconfig en1 detach
 

ifconfig (configures IP address)

chdev (add aliases to network interface)
Starting and stopping a network interface
ifconfig qfe0 up
ifconfig qfe0 down
/sbin/ifup eth0
/sbin/ifdown eth0
/sbin/ifup eth0
/sbin/ifdown eth0
ifconfig lan0 up
ifconfig lan0 down
note: there is no "ifconfig -a" in hpux use lanscan then "ifconfig <interface>"
ifconfig en0 up
ifconfig en0 down
ifconfig en0 detach (remove)
Setting NIC speed
ndd -set <device> <parm> <value> (dynamically) 
/etc/system (edit and update then reboot - permanent)
mii-tool -F 100baseTx-FD eth0
ethtool -s eth1 speed 100 duplex full
ethtool -s eth1 speed 100 duplex full
ndd -set <device> <parm> <value>
lanadmin -X <option> lan0
chdev -l ent0 -a media_speed=1000_Full_Duplex -P
chdev -l ent0 -a media_speed=Auto_Negotiation -P
 

Note:
entX - physical device
enX - frame type run on entX
Change NIC parameters
ndd -get <device> <parm>

# List parameters
 
ndd -get /dev/hme \?
ndd -get /dev/e1000g0 \?
ndd -get /dev/ip \?
ndd -get /dev/tcp \?
mii-tool -v 
ethtool eth1
ethtool -t eth0 online
 

sysctl -a | grep net*
ethtool eth0 

sysctl -a |grep net*
lanadmin -> lan -> display

## options supported
 
ndd -get /dev/ip ?
ndd -get /dev/tcp ?
ndd -get /dev/arp ?
ndd -get /dev/udp ?
netstat -v
entstat -d <interface>
 

no -a
no -o "ipforwarding=1"
Display NIC statistics



netstat -i [-I interface] 
netstat -s
netstat -i [-f inet] 
netstat -s
 
entstat -d <interface>
display MAC address
ifconfig -a (as user root)
ifconfig
system-config-network (GUI)
ifconfig
lanscan
netstat -ia
Displaying network packets
snoop -d <interface>
tcpdump -i <interface>
ethereal (needs to be installed)
tcpdump -i <interface>
ethereal (needs to be installed)
nettl -start
nettl -status all
nettl -tn pduin pduout -e ns_ls_driver -file /var/adm/LAN
nettl -stop
use netfmt to display the trace file
tcpdump -i <interface> 
iptrace -i <interface> <output file>
ipreport (used with iptrace to view reports)
 
Note: you must stop the iptrace by using "kill -15"
default router
/etc/defaultrouter

route add default <gteway>
edit /etc/sysconfig/network
add: GATEWAY=<IP address>
edit /etc/network/interfaces

add: gateway <IP address>
/etc/rc.config.d/netconf
route add 0 <gateway IP address>

Note: there is no file that holds the default router
display routing table
netstat -rn
netstat -rn
route -n
netstat -rn
route -n
netstat -rn
netstat -rn
netstat -r -f inet
lsattr -EHl inet0 -a route
Test IPMP, Bonding
if_mpadm -d           (detach)
if_mpadm -r           (reattach)
tail /var/adm/messages
ifenslave -d bond0 eth1   (detach) 
ifenslave bond0 eth1       (reattach)
cat /proc/net/bonding/bond0
ifenslave -d bond0 eth1   (detach) 
ifenslave bond0 eth1       (reattach)
cat /proc/net/bonding/bond0
You buy an optional product called Auto-Port Aggragation.
smitty etherchannel (creates, deletes and tests) 

entstat -d ent0
change the hostname
change the following files:
/etc/nodename
/etc/hostname.<interface>
/etc/inet/hosts
/etc/inet/ipnodes
/etc/net - few files in here as well
/etc/sysconfig/network
/etc/hosts

sysctl -a |grep hostname
/etc/hostname
/etc/hosts

sysctl -a |grep hostname
set_parms hostname (requires reboot)
hostname <new hostname> 
chdev -l inet0 -a hostname=<hostname>
setup DNS
/etc/resolv.conf
/etc/resolv.conf
/etc/resolv.conf
/etc/resolv.conf
/etc/resolv.conf
Name service switch file (DNS client)
/etc/nsswitch.conf
/etc/resolv.conf
/etc/nsswitch.conf
/etc/host.conf
/etc/resolv.conf
/etc/nsswitch.conf
/etc/host.conf
/etc/resolv.conf
/etc/nsswitch.conf
/etc/resolv.conf
/etc/netsvc.conf
/etc/resolv.conf
/etc/irs.conf (may not be there)
 

chnamsv     (change name service)
 
rmnamsv     (remove a name service)
 
lsnamsv -C   (list name services)
 
Flush DNS cache
svcadm restart system/name-service-cache:default
## if installed 
service nscd restart

n/a
netcdctrl -t dns -e hosts -f
Domain Name
/etc/defaultdomain
/etc/sysconfig/network  (HOSTNAME option)
/etc/resolv.conf
 

Note: for NIS use the NISDOMAIN option
/etc/host
/etc/resolv.conf
/etc/rc.config.d/netconf
domainname <domainname>
Obtain IP Address routing
route -n get <hostname>
traceroute
ip route get <IP address> 
traceroute
ip route get <IP address>
traceroute
n/a
route -n get <hostname>
Find Services on the network
Boot (jumpstart) servers:
rpcinfo -b bootparam 1
NFS servers:
rpcinfo -b mountd 1
NIS servers/slaves:
rpcinfo -b ypserv 1
Boot (jumpstart) servers:
rpcinfo -b bootparam 1
NFS servers:
rpcinfo -b mountd 1
NIS servers/slaves:
rpcinfo -u <yp server> ypserv
Boot (jumpstart) servers:
rpcinfo -b bootparam 1
NFS servers:
rpcinfo -b mountd 1
NIS servers/slaves:
rpcinfo -u <yp server> ypserv
Boot (jumpstart) servers:
rpcinfo -b bootparam 1
NFS servers:
rpcinfo -b mountd 1
NIS servers/slaves:
rpcinfo -b ypserv 1
Boot (jumpstart) servers:
rpcinfo -b bootparam 1
NFS servers:
rpcinfo -b mountd 1
NIS servers/slaves:
rpcinfo -b ypserv 1

0 yorum:

Yorum Gönder