際際滷

際際滷Share a Scribd company logo
C畉u h狸nh IP Address (NIC CARD) tr棚n Unix! 
1. Tr棚n Fedora / RedHat / CentOS 
Chuy畛n vo th動 m畛c sau: 
#cd /etc/sysconfig/network/ 
#vi /etc/sysconfig/network/ifcfg-eth0 
ho畉c 
#pico /etc/sysconfig/network/ifcfg-eth0 
Khai b叩o c叩c th担ng s畛 v畛 IP Address, Subnet Mask, .... v d湛ng l畛nh 
#/etc/init.d/network restart 
Cu畛i c湛ng, d湛ng l畛nh b棚n d動畛i 畛 ki畛m ch畛ng IP Address, NetMask, ...: 
#ifconfig -a 
2. Tr棚n Solaris 5.10 
B畉n c畉n l動u 箪 c叩c t畉p tin sau: 
/etc/hosts 
/etc/resolve.config 
/etc/defalutrouter 
/etc/nsswitchconfig 
B畉n c坦 th畛 g叩n b畉ng tay nh動 sau: 
# ifconfig e1000g0 plumb 
# ifconfig e1000g0 192.168.1.2 netmask 255.255.255.0 up 
#route add -net 192.168.1.0 -netmask 255.255.255.0 192.168.1.1 
# ifconfig -a 
DISABLE AN INTERFACE 
# ifconfig <interface> down unplumb 
SHOW ALL INTERFACE 
#dladm show-link
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv 4,VIRTUAL> mtu 8232 index 1 
inet 127.0.0.1 netmask ff000000 
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 
inet 192.168.1.101 netmask ffffff00 broadcast 192.168.1.255 
ether 8:0:27:4:39:f7 
3. Solaris Network configuration 
Solaris Network configuration 
Setting up Solaris networking often becomes challenging for the new sysadmins and new owners of Sun systems . This document details the 
steps involved in setting up of Solaris networking and can be used as a check list if you are already familiar with Solaris network configuration . 
Table of contents : 
3.1. Enable the network card 
3.2. Configuring ipaddress and netmask and making the interface status as up . 
3.3. Configuring Virtual interface : 
3.4. Ip-forwarding 
3.5. Router Configuration 
3.6. Network Terms 
3.7. Next Steps 
ifconfig command is used in Solaris to configure the network interfaces. The following lines describes the activities needed to configure a freshly 
installed network card from the root prompt . 
3.1. Enable the network card 
#ifconfig hme0 plumb 
ifconfig -a command should show following type of output which means device is enabled and is ready to configure ip address and netmask :
hme0: flags=842 mtu 1500 
inet 0.0.0.0 netmask 0 
ether 3:22:11:6d:2e:1f 
3.2. Configuring ipaddress and netmask and making the interface status as up . 
#ifconfig hme0 192.9.2.106 netmask 255.255.255.0 up 
#ifconfig -a will now show the ip address , netmask and up status as follows : 
hme0: flags=843 mtu 1500 
inet 192.9.2.106 netmask ffffff00 broadcast 192.9.2.255 
ether 3:22:11:6d:2e:1f 
The file /etc/netmasks is used to define netmasks for ip addresses . 
127.0.0.1, is the standard loop back route and 127.0.0.0 is the default loopback ipaddress used by the kernel when no interface is configured this 
will be the only entry displayed by the system on invoking ifconfig -a command.. 
3.3. Configuring Virtual interface 
Virtual interface can be configured to enable hme0 reply to more then one ip addresses. This is possible by using hme0 alias which can be 
configured by ifconfig command only . The new alias device name now becomes hme0:1 hme:2 etc. 
#ifconfig hme0:1 172.40.30.4 netmask 255.255.0.0 up 
ifconfig -a will show the original hme0 and alias interface : 
hme0: flags=843 mtu 1500
inet 192.9.2.106 netmask ffffff00 broadcast 192.9.2.255 
ether 3:22:11:6d:2e:1f 
hme0:1: flags=842 mtu 1500 
inet 172.40.30.4 netmask ffff0000 broadcast 172.40.255.255 
3.4. Ip-forwarding 
IP forwarding allows you to forward all requests coming for a certain port or URL to be redirected to a specified IP address. 
ip forwarding becomes enabled automatically when system detects more then one interface at the booting time . The file involved is 
/etc/rc2.d/S69inet . 
ipforwarding is on by default but can be turned off by following command : 
#ndd -set /dev/ip ip_forwarding 0 
3.5. Router Configuration 
After interfaces and ipaddess have been configured the system needs a default router which will allow the machine to talk to world outside of 
local network . You can specify a particular route for a particular address as in following example 
#route add -net 10.0.0.0 -netmask 255.0.0.0 172.40.30.1 1 
if the the destination ipaddess is not defined in this manner system forwards all requests to the default router . 
default route is defined manually by editing /etc/defaultrouter file and putting routers ipaddress entry in it. This file is read by /etc/rc2.d/S69inet 
file during the booting process and entry added to the routing table . 
The route can be defined online also using routeadd command but the changes will be lost on reboot .To make changes permanent make sure to 
put an entry in /etc/defaultrouter. 
#route add default 205.100.155.2 1 
#route change default 205.100.155.2 1 
The 1 at the end is the number of hops to the next gateway.
If an interface is not responding to the network, check to be sure it has the correct IP address and netmask , network cables are fine . 
3.6. Network Terms 
CIDR 
CIDR : Classless Inter-Domain Routing  the notation often used instead of writing the subnet mask along with ip-address . It has network prefix 
at the end of a address as / number of network bits.This means that the IP address 192.200.20.10 with the subnet mask 255.255.255.0 can also be 
expressed as 192.200.20.10/24. The /24 indicates the network prefix length, which is equal to the number of continuous binary one-bits in the 
subnet mask (11111111.11111111.11111111.000000). Zeros are for addressing the hosts on this network. 
VLSM 
network can be variably subnetted into smaller networks, each smaller network having a different subnet mask .This functionality is avaiable in 
Solaris 2.6 above. the ipaddresses 
4. Tr棚n Ubuntu 
4.1. C畉u h狸nh DHCPcho card m畉ng 
N畉u b畉n mu畛n c畉u h狸nh 畛a ch畛 DHCP, b畉n c畉n ch畛nh s畛a t畉p tin /etc/network/interfaces v nh畉p vo c叩c d嘆ng 畛 thay th畛 card m畉ng c畛a b畉n. 
- D湛ng l畛nh: 
#sudo vi /etc/network/interfaces 
- Nh畉p vo nh動 sau: 
# The primary network interface  use DHCP to find our address 
auto eth0 
iface eth0 inet dhcp 
4.2. C畉u h狸nh 畛a ch畛 IP t挑nh 
N畉u b畉n mu畛n c畉u h狸nh 畛a IP t挑nh, b畉n c畉n ch畛nh s畛a t畉p tin /etc/network/interfaces v nh畉p vo c叩c d嘆ng 畛 thay th畛 card m畉ng c畛a b畉n.
- D湛ng l畛nh 
#sudo vi /etc/network/interfaces 
# The primary network interface 
auto eth0 
iface eth0 inet static 
address 172.25.25.25 
gateway172.25.25.1 
netmask 255.255.255.0 
network 172.25.25.0 
broadcast 172.25.25.255 
Sau khi nh畉p c叩c tham s畛 b畉n ph畉i restart card m畉ng c畛a b畉n b畉ng l畛nh sau (d達y IP t担i d湛ng trong h畛 th畛ng c畛a t担i, c嘆n b畉n th狸 ch畉c kh叩c ): 
#sudo /etc/init.d/networking restart 
4.3. Thi畉t l畉p 畛a ch畛 th畛 2 (畛a ch畛 IP 畉o trong Ubuntu) 
N畉u b畉n l ng動畛i qu畉n tr畛 h畛 th畛ng ho畉c ng動畛i d湛ng, 担i l炭c b畉n r畉t c畉n c坦 th棚m 畛a ch畛 IP th畛 2 cho m叩y Ubuntu c畛a b畉n. 畛 lm i畛u ny, b畉n c畉n 
ch畛nh s畛a t畉p tin /etc/network/interfaces v b畉n c畉n theo c叩c c炭 ph叩p sau. B棚n d動畛i l v鱈 d畛 m b畉n c畉n thay 畛i theo 畛a ch畛 IP m b畉n c畉n thi畉t l畉p 
- D湛ng l畛nh 
#sudo vi /etc/network/interfaces 
auto eth0:1 
iface eth0:1 inet static 
address 192.168.1.60 
netmask 255.255.255.0 
network x.x.x.x 
broadcast x.x.x.x 
gateway x.x.x.x 
B畉n c畉n nh畉p vo t畉t c畉 chi ti畉t: address, netmask, network, broadcast and gateways. Sau khi hon t畉t v l動u l畉i t畉p tin ny, 畛ng qu棚n restart l畉i card 
m畉ng 畛 nh畉n 動畛c c叩c th担ng tin NEW IP ADDRESS c畛a b畉n. 
D湛ng l畛nh sau 畛 restart l畉i card m畉ng
#sudo /etc/init.d/networking restart 
4.4. Thi畉t l畉p hostname 
Thi畉t l畉p hostname tr棚n Ubuntu, b畉n c坦 th畛 truy v畉n, thi畉t l畉p tr畛c ti畉p tr棚n Ubuntu b畉ng l畛nh hostname (c叩c Unix kh叩c th動畛ng d湛ng l畛nh ny 畛 thi畉t 
l畉p hostname). 
Trong Ubuntu b畉n c坦 d湛ng l畛nh sau: 
#sudo /bin/hostname 
V鱈 d畛: 
#sudo /bin/hostname vnuhcmserver 
Khi kh畛i 畛ng l畉i n坦 s畉 t畛 畛ng 畛c hostname t畛 /etc/hostname 
B畉n c坦 th畛 tham kh畉o th棚m c叩c th担ng tin kh叩c 畛 r探 th棚m, xin vui l嘆ng 畛c th棚m t畛 畛a ch畛 T畉I Y 
4.5. Khai b叩o th担ng s畛 DNS 
When it comes to DNS setup Ubuntu doesnt differ from other distributions. You can add hostname and IP addresses to the file /etc/hosts for static 
lookups. 
Khi thi畉t l畉p DNS, Ubuntu c滴ng nh動 c叩c HH kh叩c, b畉n c坦 th棚m hostname & IP Address cho t畉p tin /etc/hosts 
Nguy棚n nh但n m叩y Ubuntu c畛a b畉n tra c畛u server li棚n quan cho vi畛c t狸m ki畉m t棚n, 董n gi畉n b畉n ch畛 c畉n th棚m 畛a ch畛 DNS Server (gi畉 s畛 b畉n 達 bi畉t) 
vo t畉p tin /etc/resolv.conf 
V鱈 d畛 m叩y ch畛 DNS c畛a b畉n c坦 畛a ch畛 IP l 172.16.1.2, b畉n th棚m vo t畉p tin resolv.conf theo l畛nh sau: 
#sudo vi /etc/resolv.conf 
Nh畉p vo 
search vnuhcm.edu.vn 
nameserver 172.16.1.2
Gi畉 s畛 r畉ng t棚n mi畛n c畛a b畉n l vnuhcm.edu.vn 
Ch炭c B畉n thnh c担ng,

More Related Content

Basic cau hinh ip tren solaris

  • 1. C畉u h狸nh IP Address (NIC CARD) tr棚n Unix! 1. Tr棚n Fedora / RedHat / CentOS Chuy畛n vo th動 m畛c sau: #cd /etc/sysconfig/network/ #vi /etc/sysconfig/network/ifcfg-eth0 ho畉c #pico /etc/sysconfig/network/ifcfg-eth0 Khai b叩o c叩c th担ng s畛 v畛 IP Address, Subnet Mask, .... v d湛ng l畛nh #/etc/init.d/network restart Cu畛i c湛ng, d湛ng l畛nh b棚n d動畛i 畛 ki畛m ch畛ng IP Address, NetMask, ...: #ifconfig -a 2. Tr棚n Solaris 5.10 B畉n c畉n l動u 箪 c叩c t畉p tin sau: /etc/hosts /etc/resolve.config /etc/defalutrouter /etc/nsswitchconfig B畉n c坦 th畛 g叩n b畉ng tay nh動 sau: # ifconfig e1000g0 plumb # ifconfig e1000g0 192.168.1.2 netmask 255.255.255.0 up #route add -net 192.168.1.0 -netmask 255.255.255.0 192.168.1.1 # ifconfig -a DISABLE AN INTERFACE # ifconfig <interface> down unplumb SHOW ALL INTERFACE #dladm show-link
  • 2. lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv 4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.1.101 netmask ffffff00 broadcast 192.168.1.255 ether 8:0:27:4:39:f7 3. Solaris Network configuration Solaris Network configuration Setting up Solaris networking often becomes challenging for the new sysadmins and new owners of Sun systems . This document details the steps involved in setting up of Solaris networking and can be used as a check list if you are already familiar with Solaris network configuration . Table of contents : 3.1. Enable the network card 3.2. Configuring ipaddress and netmask and making the interface status as up . 3.3. Configuring Virtual interface : 3.4. Ip-forwarding 3.5. Router Configuration 3.6. Network Terms 3.7. Next Steps ifconfig command is used in Solaris to configure the network interfaces. The following lines describes the activities needed to configure a freshly installed network card from the root prompt . 3.1. Enable the network card #ifconfig hme0 plumb ifconfig -a command should show following type of output which means device is enabled and is ready to configure ip address and netmask :
  • 3. hme0: flags=842 mtu 1500 inet 0.0.0.0 netmask 0 ether 3:22:11:6d:2e:1f 3.2. Configuring ipaddress and netmask and making the interface status as up . #ifconfig hme0 192.9.2.106 netmask 255.255.255.0 up #ifconfig -a will now show the ip address , netmask and up status as follows : hme0: flags=843 mtu 1500 inet 192.9.2.106 netmask ffffff00 broadcast 192.9.2.255 ether 3:22:11:6d:2e:1f The file /etc/netmasks is used to define netmasks for ip addresses . 127.0.0.1, is the standard loop back route and 127.0.0.0 is the default loopback ipaddress used by the kernel when no interface is configured this will be the only entry displayed by the system on invoking ifconfig -a command.. 3.3. Configuring Virtual interface Virtual interface can be configured to enable hme0 reply to more then one ip addresses. This is possible by using hme0 alias which can be configured by ifconfig command only . The new alias device name now becomes hme0:1 hme:2 etc. #ifconfig hme0:1 172.40.30.4 netmask 255.255.0.0 up ifconfig -a will show the original hme0 and alias interface : hme0: flags=843 mtu 1500
  • 4. inet 192.9.2.106 netmask ffffff00 broadcast 192.9.2.255 ether 3:22:11:6d:2e:1f hme0:1: flags=842 mtu 1500 inet 172.40.30.4 netmask ffff0000 broadcast 172.40.255.255 3.4. Ip-forwarding IP forwarding allows you to forward all requests coming for a certain port or URL to be redirected to a specified IP address. ip forwarding becomes enabled automatically when system detects more then one interface at the booting time . The file involved is /etc/rc2.d/S69inet . ipforwarding is on by default but can be turned off by following command : #ndd -set /dev/ip ip_forwarding 0 3.5. Router Configuration After interfaces and ipaddess have been configured the system needs a default router which will allow the machine to talk to world outside of local network . You can specify a particular route for a particular address as in following example #route add -net 10.0.0.0 -netmask 255.0.0.0 172.40.30.1 1 if the the destination ipaddess is not defined in this manner system forwards all requests to the default router . default route is defined manually by editing /etc/defaultrouter file and putting routers ipaddress entry in it. This file is read by /etc/rc2.d/S69inet file during the booting process and entry added to the routing table . The route can be defined online also using routeadd command but the changes will be lost on reboot .To make changes permanent make sure to put an entry in /etc/defaultrouter. #route add default 205.100.155.2 1 #route change default 205.100.155.2 1 The 1 at the end is the number of hops to the next gateway.
  • 5. If an interface is not responding to the network, check to be sure it has the correct IP address and netmask , network cables are fine . 3.6. Network Terms CIDR CIDR : Classless Inter-Domain Routing the notation often used instead of writing the subnet mask along with ip-address . It has network prefix at the end of a address as / number of network bits.This means that the IP address 192.200.20.10 with the subnet mask 255.255.255.0 can also be expressed as 192.200.20.10/24. The /24 indicates the network prefix length, which is equal to the number of continuous binary one-bits in the subnet mask (11111111.11111111.11111111.000000). Zeros are for addressing the hosts on this network. VLSM network can be variably subnetted into smaller networks, each smaller network having a different subnet mask .This functionality is avaiable in Solaris 2.6 above. the ipaddresses 4. Tr棚n Ubuntu 4.1. C畉u h狸nh DHCPcho card m畉ng N畉u b畉n mu畛n c畉u h狸nh 畛a ch畛 DHCP, b畉n c畉n ch畛nh s畛a t畉p tin /etc/network/interfaces v nh畉p vo c叩c d嘆ng 畛 thay th畛 card m畉ng c畛a b畉n. - D湛ng l畛nh: #sudo vi /etc/network/interfaces - Nh畉p vo nh動 sau: # The primary network interface use DHCP to find our address auto eth0 iface eth0 inet dhcp 4.2. C畉u h狸nh 畛a ch畛 IP t挑nh N畉u b畉n mu畛n c畉u h狸nh 畛a IP t挑nh, b畉n c畉n ch畛nh s畛a t畉p tin /etc/network/interfaces v nh畉p vo c叩c d嘆ng 畛 thay th畛 card m畉ng c畛a b畉n.
  • 6. - D湛ng l畛nh #sudo vi /etc/network/interfaces # The primary network interface auto eth0 iface eth0 inet static address 172.25.25.25 gateway172.25.25.1 netmask 255.255.255.0 network 172.25.25.0 broadcast 172.25.25.255 Sau khi nh畉p c叩c tham s畛 b畉n ph畉i restart card m畉ng c畛a b畉n b畉ng l畛nh sau (d達y IP t担i d湛ng trong h畛 th畛ng c畛a t担i, c嘆n b畉n th狸 ch畉c kh叩c ): #sudo /etc/init.d/networking restart 4.3. Thi畉t l畉p 畛a ch畛 th畛 2 (畛a ch畛 IP 畉o trong Ubuntu) N畉u b畉n l ng動畛i qu畉n tr畛 h畛 th畛ng ho畉c ng動畛i d湛ng, 担i l炭c b畉n r畉t c畉n c坦 th棚m 畛a ch畛 IP th畛 2 cho m叩y Ubuntu c畛a b畉n. 畛 lm i畛u ny, b畉n c畉n ch畛nh s畛a t畉p tin /etc/network/interfaces v b畉n c畉n theo c叩c c炭 ph叩p sau. B棚n d動畛i l v鱈 d畛 m b畉n c畉n thay 畛i theo 畛a ch畛 IP m b畉n c畉n thi畉t l畉p - D湛ng l畛nh #sudo vi /etc/network/interfaces auto eth0:1 iface eth0:1 inet static address 192.168.1.60 netmask 255.255.255.0 network x.x.x.x broadcast x.x.x.x gateway x.x.x.x B畉n c畉n nh畉p vo t畉t c畉 chi ti畉t: address, netmask, network, broadcast and gateways. Sau khi hon t畉t v l動u l畉i t畉p tin ny, 畛ng qu棚n restart l畉i card m畉ng 畛 nh畉n 動畛c c叩c th担ng tin NEW IP ADDRESS c畛a b畉n. D湛ng l畛nh sau 畛 restart l畉i card m畉ng
  • 7. #sudo /etc/init.d/networking restart 4.4. Thi畉t l畉p hostname Thi畉t l畉p hostname tr棚n Ubuntu, b畉n c坦 th畛 truy v畉n, thi畉t l畉p tr畛c ti畉p tr棚n Ubuntu b畉ng l畛nh hostname (c叩c Unix kh叩c th動畛ng d湛ng l畛nh ny 畛 thi畉t l畉p hostname). Trong Ubuntu b畉n c坦 d湛ng l畛nh sau: #sudo /bin/hostname V鱈 d畛: #sudo /bin/hostname vnuhcmserver Khi kh畛i 畛ng l畉i n坦 s畉 t畛 畛ng 畛c hostname t畛 /etc/hostname B畉n c坦 th畛 tham kh畉o th棚m c叩c th担ng tin kh叩c 畛 r探 th棚m, xin vui l嘆ng 畛c th棚m t畛 畛a ch畛 T畉I Y 4.5. Khai b叩o th担ng s畛 DNS When it comes to DNS setup Ubuntu doesnt differ from other distributions. You can add hostname and IP addresses to the file /etc/hosts for static lookups. Khi thi畉t l畉p DNS, Ubuntu c滴ng nh動 c叩c HH kh叩c, b畉n c坦 th棚m hostname & IP Address cho t畉p tin /etc/hosts Nguy棚n nh但n m叩y Ubuntu c畛a b畉n tra c畛u server li棚n quan cho vi畛c t狸m ki畉m t棚n, 董n gi畉n b畉n ch畛 c畉n th棚m 畛a ch畛 DNS Server (gi畉 s畛 b畉n 達 bi畉t) vo t畉p tin /etc/resolv.conf V鱈 d畛 m叩y ch畛 DNS c畛a b畉n c坦 畛a ch畛 IP l 172.16.1.2, b畉n th棚m vo t畉p tin resolv.conf theo l畛nh sau: #sudo vi /etc/resolv.conf Nh畉p vo search vnuhcm.edu.vn nameserver 172.16.1.2
  • 8. Gi畉 s畛 r畉ng t棚n mi畛n c畛a b畉n l vnuhcm.edu.vn Ch炭c B畉n thnh c担ng,