How to Set dhcpd in linuxHow to Set DHCP in linuxSetting DHCP in linux is not complicated at all. All you have to do is to set up one file:/etc/dhcpd. conf.Next, I will use my own settings file to explain how to modify this file ﹕Default-lease-time 259200;Max-lease-time 777600;Option domain-name "siyongc ";I put these lines at the beginning of the file. The first and second rows define the default term and maximum term of the lease contract ﹐The value is calculated in seconds, that is, 'three da
/***************************************************************************** * Subnet mask, mask length relationship * Statement: * When we operate the Linux system, we often see that we can use the subnet mask, mask length to represent the mask, * for me, has been curious is the subnet mask between 1 can clip a 0, if the clip 0, the mask length * bad calculation. * 2016-5-5 Shenzhen Nanshan Ping Shan village Zengjianfeng ****************************************************** *****************
the upper limit will be discarded and not processed) to prevent DoS attacks, that is, flood attacks on a large number of data packets.
# Limit SYN flood
# Iptables-a input-f-m limit -- limit 100/s -- limit-burst 100-jACCEPT # limit the sending speed of internal packets
# Iptables-a forward-f-m limit -- limit 100/s -- limit-burst 100-jACCEPT # restrict the speed of creating online forwarding packets
# Allow local Loopback interface, that is, 127.0.0.1
# Allow loopback
Iptables-a input-I lo-p all
IP Address Subnet mask calculation, return IP segment start and end range, length, mask and other information.
/**
* Mask Calculator
* @author Weaksun
* @param string $ip IP
* @param Numeric $bits Mask
* @return Array Returns the result set
*/
function netmask ($ip, $bits = 24) {
$result = [
' Start ' = + 0,//First IP
' End ' = 0,//Last IP
' Length ' = 0,//
the Ip address based on the company's network proxy. Pay attention to awk here, use = to divide each line, and output the variable = variable before = to the backup file; then replace the original Ip configuration file and restart the NIC. The ip address must be pinged before it can be used. Otherwise, there will be ip conflict.
function config_ip(){NETWORK_PATH=/etc/sysconfig/network-scripts/ENFILE=`ls $NETWORK_PATH/ifcfg-en*`IPADDR="10.4.45.211"NETMASK
corresponding configuration file name is ifcfg-ethN: M, where N and M are numbers starting from 0, representing the serial number. For example, the configuration file for the first virtual network card (device name eth0: 0) bound to the first ethernet card is ifcfg-eth0: 0. Linux supports up to 255 IP aliases, which can be obtained by copying the ifcfg-eth0 profile and modifying its configuration content.
In the NIC configuration file, each line is a configuration item. The functions and lines
romMACADDR: Modify to the specified MAC addressNM_CONTROLLED:NM is a shorthand for networkmanager, it is recommended to set to NoOnboot: Whether this device is activated with OS bootType: Device types, usually with "Ethernet", "Bridge"UUID: Unique identification code for the network card deviceIPADDR: IP address of this interfaceNETMASK: Subnet mask, EX 255.255.255.0Subnet mask in PREFIX:CIDR format, EX 24-bit mask (this one with netmask, this)Gatewa
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 a Linux system, routing is usually done to address the following problem: The Linux system in a LAN, the LAN has a gateway to allow the machine to access the Internet, it is necessary to set the IP address of this machine is
= before the variable =, output to the backup file, and then replace the original IP profile, and finally restart the NIC. IP before setting must ping, not generalists can use, otherwise there will be IP conflicts.function Config_ip () {Network_path=/etc/sysconfig/network-scripts/Enfile= ' ls $NETWORK _path/ifcfg-en*' IPAddr="10.4.45.211"NETMASK="255.255.255.0"GATEWAY="10.4.45.1"DNS1="210.83.210.155"Temp_file="ifcfg.temp"Cat $ENFILE| Awk-f"=" '{ if(
(DHCP)
2.3.4 Netmask, subnet with CIDR (classless interdomain Routing) Netmask, or Subnet mask (subnet mask)
netmask:255.255.255.0
network:192.168.0.0
broadcast:192.168.0.255
Sub-mesh SegmentationThe original C Class net_id and host_id respectively 11000000.10101000.00000000.00000000 Network: 192.168.0.0110
Address255.255.255.0: Subnet MaskSubnet mask 255-bit corresponding IP bit for network bitSubnet mask 0-bit IP-bit corresponding to main camera####################To view IP commands:1. "Ifconfig", if a network card is configured with dual IP, then use "ifconfig" is not visible2. "IP addr Show", you can see all the IP####################################### #2. Configuring ip####################1. GraphicalNm-connection-editor2. TextualNmtuiIfconfig NIC IP [n
Two methods of adding soft routes in LinuxThe first type:Route add-net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.254 Dev eth0/* Add a network 172.16.6.0/24 through 172.16.2.254 eth0 *//*-net Add Network-host Add host netmask subnet mask GW Gateway Dev device, device, here is your network card name */Route del GW 172.16.2.254/* Delete Default gateway 172.16.2.254 */Route del-net 172.16.86.0/24/* Delete 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.