Change IP address under Solaris
1. The ifconfig command is temporarily modified.
Ifconfig is used to configure the IP address of the NIC. It takes effect after modification, but is not saved. It becomes invalid after the next startup.
# Ifconfig-A ---> obtain the name of the NIC. Generally, the first M Nic is named
Hme0
# Ifconfig hme0 down ---> stop the service of the NIC hme0 temporarily
# Ifconfig hme0 192.168.1.100 netmask 255.255.255.0 up ---> Start the NIC
2. Change the IP address permanently
You need to modify the following files:
/Etc/hosts add machine name and IP address
Example: 192.168.1.100 sky100 loghost
Change/etc/inet/hosts networks netmasks to 3 files
/Etc/NET/*/hosts * is the three directories, and the hosts under the three directories is changed.
/Etc/nodename
/Etc/netmasks
Example: 192.168.1.0 255.255.255.0
/Etc/hostname. hme0 change the IP address of the NIC
For example, change to 192.168.1.100.
/Etc/defaultrouter add to Gateway
Example: 192.168.1.1
/Etc/resolv. conf add to DNS Server
For example:
Nameserver 202.106.0.20
Nameserver 202.106.196.115
Modify the/etc/nsswitch. conf file.
Find this line of hosts: Files
Change to hosts: Files DNS
That is, if the domain name cannot be found in/etc/hosts, it will go to DNS resolution.
After the modification is complete, restart.
If the NIC is changed or the NIC is added, the interface service cannot be started automatically. You need to create a network port manually.
Service:
# Ifconfig hme0 plumb
You can create a network port service for the interface hme0.
Correspondingly, the ifconfig with the unplumb parameter can be used to stop the service and disable the network.
/Etc/hostname. hme0 Nic hme0 IP Address
Table of IP addresses of host names in the/etc/hosts Network
/Etc/netmasks
/Etc/nsswitch. conf domain name resolution method and Sequence
/Etc/resolv. conf DNS server address and domain name
/Etc/defaultrouter set the default gateway address
/Etc/nodename Host Name
/Etc/NET/ticlts/hosts
/Etc/NET/ticots/hosts
/Etc/NET/ticotsord/hosts