How to add IP under CentOS
First, add a single IP method:
# cd/etc/sysconfig/network-scripts
# CP Ifcfg-eth0 ifcfg-eth0:0
# Nano ifcfg-eth0:0 Copy Code
Copy a eth0 file with the CP command, the new file name is eth0:0, and then edit the file with the nano. Not used to using the Nano can be used with the VI command. Edit after opening file:
device=eth0:0 #此处添加: 0, keeping the same file name, adding multiple IP increments sequentially
Onboot=yes #是否开机激活
Bootproto=static #静态IP, please enter DHCP
network port in ifconfig:
The ifconfig tool configures network interfaces through command parameters. We only need to specify the most common parameters;
Ifconfig network port IP address HW
* Instance 1:For example, we use ifconfig to debug the address of the eth0 Nic.
[root@localhost ~]# ifconfig eth0 down [root@localhost ~]# ifconfig eth0 192.168.1.99 broadcast 192.168.1.255 netmask 255.255.255.0[root@localhost ~]# ifconfig eth0 up [root@localhost
). All packets using this route will
Be gatewayed through "mango-GW". The device which will be actually be used for that route depends on how we
Can reach "mango-GW"-the static route to "mango-GW" will have to be set up before.
Format: Route add-net {network-address} netmask {netmask} Dev {interface-name}
The routing rules added to the specified network.
Parameter {network-address}: used to specify
change the system's configuration file about the NIC. If you want to fix the IP address of the network interface, there are currently three methods: one is to modify the IP address through the various distribution and version-specific tools; the other is to modify the network interface configuration file directly; The third is to modify specific files, add ifconfig instructions to specify the IP address of the network card, For example, in Redhat or Fedora, the Ifconfig's name is written into/e
In Linux, how do I set IP addresses? We can use commands to set the IP address, but the prerequisite for this method is that the user needs the root permission. The nic ip Address Configuration information is stored in the/etc/sysconfig/network-script/ifcfg-eth0 file of the Linux system. The specific format is:# Cat ifcfg-eth0 [root @ localhost network-Scripts] #
Device = eth0
Bootproto = none
Onboot = Yes
Type = Ethernet
Netmask = 255.255.2
In order for the device to access another subnet, you need to increase the routing to the sub-network in the device, here are some information. The basic operations are as follows:In general, to be able to access other subnets to set up the route, for example, your host is in 192.168.10.0/24, and you want to access the 192.168.20.0/24 network host, of course, you know a gateway IP, For example 192.168.10.1 (must be on the same subnet as your host), you can configure the route as such.Add routeRo
route command are as follows:Destination targetThe destination network or destination host. Target network or target host.
GatewayThe gateway address or '*' If none set. gateway address, if not, an asterisk is displayed.
genmask network mask The netmask for the destination net; '255. 255.255 'For A host destination and '0. 0.0.0 'for the default route.
flags possible flags include flag, commonly used U and G. U (route is up) routing enabled
Linux under route commandIn order for the device to access another subnet, you need to increase the routing to the sub-network in the device, here are some information. The basic operations are as follows:In general, to be able to access other subnets to set up the route, for example, your host is in 192.168.10.0/24, and you want to access the 192.168.20.0/24 network host, of course, you know a gateway IP, For example 192.168.10.1 (must be on the same subnet as your host), you can configure the
modify the specific file and add the ifconfig instruction to specify the IP address of the NIC. For example, in Redhat or Fedora, the name of the Ifconfig is written into the/etc/rc.d/rc.local file;Ifconfig How to configure network ports:Ifconfig tools to configure the network interface method is through the parameters of the directive to achieve the purpose, we only say the most commonly used parameters;Ifconfig Network port IP address HW MAC address netma
MTU indicates the maximum transmission unit. MTU values are not necessarily the same for different local networks. for Ethernet, MTU sets the Linux command line to modify the IP address, Gateway, and DNS methods.
Method 1:
Ifconfig eth0 192.168.1.18 netmask 255.255.255.0
Note: This method can make changes take effect immediately, and will be restored to the original IP address after restart.
Method 2:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
to modify the network interface configuration file directly; The third is to modify specific files, add ifconfig instructions to specify the IP address of the network card, For example, in Redhat or Fedora, the Ifconfig's name is written into/etc/rc.d/rc.local file;Ifconfig How to configure network ports:The Ifconfig tool configures the network interface by using the parameters of the instruction to achieve the goal, we only say the most commonly used parameters;Ifconfig Network Port IP address
not configuredStatic (dmz,outside) TCP interface 30000 192.168.2.2 30000 netmask 255.255.255.255Port mapping can resolve the internal service to be advertised too much, but the application of public network IP less problems.Static (dmz,outside) TCP interface 30001 192.168.2.2 30001 netmask 255.255.255.255Map the DMZ 192.168.2.2 30002 to the external 30002 port.Static (dmz,outside) TCP interface 30002 192.1
]Telnet 192.168.1.1Pix passwd:Enter Password: cisco6. access-list)This function is basically similar to cisco ios and is also the main part of firewall. It has two features: permit and deny. The network protocol generally includes ip, tcp, udp, icmp, and so on. For example: only access to the www of the Host: 222.20.16.254, Port: 80Pix515e (config) # access-list 100 permit ip any host 222.20.16.254 eq wwwPix515e (config) # access-list 100 deny ip anyPix515e (config) # accesskey-group 100 in inte
The route command in Linux is used to display and operate the IP route table (show/manipulatetheIProutingtable ). To achieve communication between two different subnets, you need a router that connects two networks or a gateway that is located in both networks.
In Linux, routing is usually set to solve the following problems: the Linux system has a gateway in a LAN that allows machines to access the Internet, then you need to set the IP address of this machine to the default route of the Linux m
1. Use of the background requires access to two networks, one is the environment of the deployment environment, the environment is not on the outside network, the external network environment is likely to be a wireless network. If both are connected, it is likely that one side will not work, that is, outside the network or intranet, often need to use the cumbersome "Disable network connection", "Enable network connection" operation to the internal and external network switching, is very trouble
/iplist.log # # Interactive input read-p "Please input the network: (eg:192.168.0.0):" NET # # Intercept the first three paragraphs, otherwise there is 1.1.1.0.249 situation net= ' Echo $net |cut-d.-f1-3 ' for i ' {1..254};d o {if ping-c1-w1 $net. $i > /dev/null, then echo $net. $i are up echo $net. $i >>/data/iplist.loG Else echo $net. $i is down fi} done Wait
6. Exercise: Write a NETID.SH,IP address and subnet mask for the computed network ID to do and operate as follows: [[emailprotected]
Port translation (PAT)
Nat is basically the same as vro,
First, you must define the IP pool, provide the address segment for internal IP address translation, and then define the Intranet segment.
Pix525 (config) # global (outside) 1 222.20.16.100-222.20.16.200 netmask 255.255.255.0
Pix525 (config) # NAT (outside) 1 192.168.0.0 255.255.255.0
If all internal addresses can be converted:
Pix525 (config) # NAT (outside) 1 0.0.0.0 0.0.0.0
In some cases, th
The route command for the Linux system is used to display and manipulate the IP routing table (show/manipulate the IP routing table). To achieve communication between two different subnets, you need a router that is connected to two networks, or a gateway to two networks. In Linux systems, routing is usually done to address the problem that the Linux system has a gateway in a local area network that allows the machine to access the Internet, so the IP address of the machine needs to be set to th
The route command for the Linux system is used to display and manipulate the IP routing table (show/manipulate the IP routing table). To achieve communication between two different subnets, you need a router that is connected to two networks, or a gateway to two networks. In Linux systems, routing is usually done to address the problem that the Linux system has a gateway in a local area network that allows the machine to access the Internet, so the IP address of the machine needs to be set to th
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.