Ip
NETMASK
GATEWAY
HOSTNAME
DNS1
DNS2
DNS3
Dynamic Address:
Dhcp:dynamic Host Configuration Protocol
Routing
Linux: The network belongs to the kernel
REDHAT5:/etc/modprobe.conf
Alias
REDHAT6:/etc/udev/rules.d/70-persistent-net.rules
Ethernet: EthX
[Email protected] rules.d]# ifconfig eth0
Eth0 Link encap:ethernet HWaddr 00:0c:29:b2:5c:04
Second-tier network uses a third-party Internet MAC address
inet addr:192.168.56.1 bcast:192.168.56.255 mask:255.255.255.0
IP address broadcast address subnet mask
Inet6 ADDR:FE80::20C:29FF:FEB2:5C04/64 Scope:link
IP6 Address Scope
Up broadcast RUNNING multicast mtu:1500 metric:1
Allow broadcast run status in startup allows multicast Maximum transmission unit metric
RX packets:417 errors:0 dropped:0 overruns:0 frame:0
Accept message number error discard inverse frame number
TX packets:351 errors:0 dropped:0 overruns:0 carrier:0
Send
collisions:0 txqueuelen:1000
Number of conflict occurrences transmission queue Length
RX bytes:39841 (38.9 KiB) TX bytes:47438 (46.3 KiB)
Bytes of bytes sent to accept
Ifconfig
-A displays configuration information for all interfaces
EthX Display configuration information for the specified interface
Ifconfig EthX
Ip/mask IP address/subnet mask
[UP|DOWM] enable | disable
REDHAT5:/etc/init.d/network {start|stop|restart|status}
RedHat6:/etc/init.d/networkmanager {start|stop|restart|status}
Gateway
Route: Route
Route
Add: Adding
-host: Host Routing
-net: Network Routing
-net 0.0.0.0
Route add-net 10.0.0.0/8 GW 192.168.56.2
Route add default GW 192.168.56.3
Del: Delete
Route Del-net 10.0.0.0/8
Route del Default
All changes made fail after restarting the network service or host
View:
Route–n: Digitally display information about each host or port
Network configuration information file:
/etc/sysconfig/network
NIC configuration information file:
/etc/sysconfig/network-scriptes/ifcfg-ethx
Device=: The associated device name, to be consistent with the second half of the file name: eth0
BOOTPROTO={STATIC|NONE|DHCP|BOOTP}: Boot protocol: To use a static address, use either statics or NONE,DHCP to obtain an address using a DHCP server.
Ipaddr:ip Address
NETMASK: Subnet Mask
Gateway: Setting the default gateway
Onboot: Whether this network interface is activated automatically when powered on
HWADDR: Hardware address, to be consistent with the address in the hardware, can be omitted
Userctl: {yes|no} allows normal user to control this interface
Peerdns: {yes|no} accepts DHCP service-specified DNS address when Bootproto is DHCP
Does not take effect immediately, but restarting the network service or host will take effect
Routing:/ETC/SYSCONFIG/NETWORK-SCRIPTS/ROUTE-ETHX
Add format one:
DEST via Nexthop
192.168.10.0/24 via 10.10.10.254
Add format two:
address0=
netmask0=
gateway0=
address0=192.168.10.0
netmask0=255.255.255.0
gateway0=10.10.10.254
The DNS server specifies a method with only one
/etc/resolv.conf
NameServer dns_ip_1
NameServer dns_ip_2
Specify local resolution
Vi/etc/hosts
Host IP host name host Alias
192.168.56.1 www.hailiao.com Hailiao
Host Name:
Hostname
Vim/etc/sysconfig/network
Setup display graphical Configuration interface
Iproute2
Ip
Link: Configure network interfaces and properties
IP link Show
IP link Set eth1 down
Addr: Protocol Address
Add
IP addr Add 192.168.56.5 dev eth1 label eth1:1
Del
IP addr del ADDRESS dev Dev
Show
IP addr Show
Flush
IP addr Flush Dev dev to prefix
Route: Routing
IP Route Show
IP route add to 10.10.10.0/24 Dev eth1 via 192.168.56.2
IP route flush to 10/8
A network card can use multiple addresses:
Network devices can alias
Eth0 eth0:0 eth0:1 ...
- Ifconfig eth1:0 192.168.56.2
- /etc/sysconfig/network-scripts/ifcfg-ethx:x
DEVICE=ETHX:X//Note that aliases cannot use DHCP IP addresses
Host access Network:
Required: IP, NETMASK, GATEWAY, HOSTNAME, DNS1, DNS2, DNS3,
The core features of the Package Manager:
- Making a software package
- Install, uninstall, upgrade, query, verify
RedHat, SUSE, Debian
Redhat Package Manager
PRM is package Manager
Debian:dpt
Front end tool: Yum Apt-get
Back-end tools:
Yum:yellowdog Update Modifier
RPM Command:
Rpm
Rpmbuild
installation, query, uninstall, upgrade, calibration, database reconstruction and other work
RPM Name:
Package: Components
Main package: bind-9.7.1-1.el5.i586.rpm
Sub-package: bind-libs-9.7.1-1.el5.i586.rpm bind-utils-9.7.1-1.el5.i586.rpm
Package name format:
name-version-release.arch.rpm
bind-major.minor.release-release.arch.rpm
Major version number: significant improvements
Minor version number: A major change in a word function
Issue number: Fixed some bugs and tweaked a bit of functionality.
Bind-9.7.1.tar.gz
RPM Package:
binary format
RPM Package Author Download the source program, after the mutation configuration is completed, made into RPM package
bind-9.7.1-1.i586 (i86_64). RPM Noarch (Platform independent)
1. Installation
Rpm–i/path/to/package_name
-H: Displays the installation progress with the # sign
-V: Show detailed progress
-VV: Show more detailed progress
--nodeps: Ignoring dependencies
--replacepkgs: Reinstall, replace the original installation
--force: Forced installation, can be re-installed or degraded
2. Enquiry
Rpm–q package_name: Query whether the specified package is already installed
RPM–QA: Querying all packages that have been installed
Rpm–qi package_name: Query The description information of the specified newspaper
RPM–QL package_name: Query the list of files generated after the installation of the specified package
RPM–QC package_name: Query the configuration file generated after the installation of the specified package
RPM–QD package_name: Query the Help file generated after the installation of the specified package
Rpm–qf/path/to/some/file: Query the specified file is generated by which RPM package is installed
If a RPM package is not already installed, we need to query its description, and the installation will generate files later.
Rpm–qpi/path/to/new_package_file
Rpm–qpl
3. Upgrade
Rpm–uvh/path/to/new_package_file if the old version is installed, upgrade it or install
Rpm–fvh/path/to/new_package_file if the old version is installed, then upgrade, or exit
4. Uninstall
Rpm–e package_name
--nodeps
5. Check
Rpm–v package_name
6. Rebuilding the database
Rpm
--REBUILDDB: Rebuilding the database
--INITDB: Initialize the database, not just build, there is no build
7. Verify the legality of the source and the completeness of the software.
[Email protected] centos]# rpm--import/etc/pki/rpm-gpg/rpm-gpg-key-centos-5
[Email protected] centos]# rpm-k vsftpd-2.0.5-16.el5_4.1.x86_64.rpmy
Rpm–k/path/to/package_file
DSA, GPG: Verifying the legitimacy of the source, that is, verifying the signature: You can use-nosignature to skim over this
SHA1, MD5: Verifying package Integrity: You can use-nodigest to skip this
Elements in the Yum repository file
/media/repodata
Primary.xml.gz
List of all RPM packages
Dependent relationships
List of files generated per RPM installation
Filelists.xml.gz
List of all files for all PRM packages in the current warehouse
Other.xml.gz
Additional information, change log for RPM package
Repomd.xml
The timestamp and checksum of the above three files is recorded
COMPS*.XML:RPM Packet Grouping information
command is one of:
- Install Package1 [Package2] [...]
- Update [PACKAGE1] [Package2] [...]
- Check-update
- upgrade [Package1] [Package2] [...]
- Remove | Erase Package1 [Package2] [...]
- list [...]
- info [...]
- provides | Whatprovides Feature1 [Feature2] [...]
- Clean [Packages | headers | metadata | dbcache | all]
- Makecache
- Groupinstall group1 [group2] [...]
- Groupupdate group1 [group2] [...]
- grouplist [Hidden] [Groupwildcard] [...]
- Groupremove group1 [group2] [...]
- GroupInfo group1 [...]
- Search string1 [string2] [...]
- Shell [FileName]
- RESOLVEDEP dep1 [DEP2] [...]
- Localinstall Rpmfile1 [Rpmfile2] [...]
- Localupdate Rpmfile1 [Rpmfile2] [...]
- Reinstall Package1 [Package2] [...]
- Downgrade Package1 [Package2] [...]
- Deplist Package1 [Package2] [...]
- Repolist [all|enabled|disabled]
- Help [command]
How to define a repo file for Yum
Centos-media.repo
This repo was used to mount the default locations for a CDROM/DVD on
CentOS-5. You can use this repo and yum to install items directly off the
DVD ISO that we release.
To use this repo, put on your DVD and use it with the other repos too:
Yum--enablerepo=c5-media [command]
Or for the media repo, does this:
Yum--disablerepo=*--enablerepo=c5-media [command]
[C5-media]
name=centos-$releasever-media
baseurl=file:///media/centos/ftp://
file:///media/cdrom/http://
file:///media/cdrecorder/file:///
Gpgcheck=1 whether to use GPG authentication
Enabled=0 whether to enable
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-5
RPM Installation
binary format
SOURCE program---"Compilation---" Binary format
Some features are compiled and selected, and cannot be used if the compilation is not selected for this attribute.
RPM package version will lag behind the source package
Compilation environment, development environment
Development libraries, development tools
Linux:c
Gnu:c
C,c++
Gcc:gnu C Complier,c
g++:
Perl Java python
Make: Project management tools
Makefile: Defines the order in which make (gcc,g++) compiles the source program in these original program files
automake,--"Makefile.in? Makefile
autoconf,--"Configure
./configure
--prefix=/path/to/somewhere
--sysconfdir=/path/to/conffile_path
Make
Make install
- Modify the PATH environment variable to be able to identify the binary file path for this program
- By default, the system searches the path of the file/lib,/usr/lib, to add additional search paths
Create a file with a. conf suffix in/etc/ld.so.conf.d/, and then write the added path directly to this file Ldconfig notification system re-search the library file -v : 显示重新搜寻库的过程
- Header file: Output to System
Default:/usr/include
Add a search path to the header file, using the link to
/usr/local/apache2/include//usr/include/
ln–s/usr/local/apache2/include/*/usr/include/or
Ln–s/usr/local/apache2/include/usr/include/apache2
- Man file path: The man directory installed under the directory specified by-prefix:/usr/share/man
- Man–m/path/to/man_dir COMMAND
- Add a manpath to the/etc/man.config
For more articles, please follow: http://www.ilovehai.com
Linux Network Basics (Dry goods)