linux network config

1, linux 代理proxy的设置

PROXY=http://wwwgate0-hk.mot.com:1080
wwwgate0-ch.mot.com
wwwgate0-sw.mot.com
proxy: wwwgate0.mot.com
DNS:  
DNS1=10.193.143.1
DNS2=10.194.128.15
sudo vim /etc/sysconfig/network-scripts/ifcfg-eth1

 

例如:/etc/sysconfig/network-scripts/ifcfg-eth0

# D-Link System Inc DGE-530T Gigabit Ethernet Adapter (rev 11)                                                                                               
DEVICE=eth1                                                                                                                                                  
HWADDR=00:13:72:20:2f:ba                                                                                                                                     
ONBOOT=yes                                                                                                                                                   
BOOTPROTO=none                                                                                                                                               
TYPE=Ethernet                                                                                                                                                
NM_CONTROLLED=no                                                                                                                                             
IPV6INIT=no                                                                                                                                                  
USERCTL=yes                                                                                                                                                  
#DNS1=10.193.143.1                                                                                                                                           
#DNS2=10.194.128.15                                                                                                                                          
                                                                                                                                                             
DNS1=10.193.143.1                                                                                                                                            
DNS2=10.194.128.15                                                                                                                                           
IPADDR=192.168.1.2                                                                                                                                           
NETMASK=255.255.255.0                                                                                                                                        
GATEWAY=192.168.1.1  

 

2,active network  
Activate:/sbin/ifup eth0        (Also: ifconfig eth0 up- Note: Even if no IP address is assigned you can listen.)

De-Activate:/sbin/ifdown eth0    (Also: ifconfig eth0 down)

GUI Interface control/configuration:

    Start/Stop network interfaces:

        /usr/bin/system-control-network (Fedora Core 2/3) 
        /usr/bin/redhat-control-network (RH 9.0 - FC-1)

网络的设置后用什么命令可以让整个网络重新启动: /etc/init.d/network restart

/etc/init.d/network {start|stop|restart|reload|status}  加上restart就可以重启了。

service network restart

 

3,Usefull Linux networking commands:

/etc/rc.d/init.d/network    start - command to start, restart or stop the network

netstat - Display connections, routing tables, stats etc

eg:

    List externally connected processes: netstat -punta

    List all connected processes: netstat -nap

    Show network statistics: netstat -s

    Display routing table info: netstat -rn

    Display interface statistics: netstat -i

ping - send ICMP ECHO_REQUEST packets to network hosts. Use Cntl-C to stop ping.

traceroute - print the route packets take to network host.

mtr- a network diagnostic tool introduced in Fedora - Like tracerouteexcept it gives more network quality and network diagnostic info. Leaverunning to get real time stats. Reports best and worst round trip timesin milliseconds.

whois - Lookup a domain name in the internic whois database.

finger - Display information on a system user. i.e. finger user@host Uses $HOME/.plan and $HOME/.project user files. Often used by game developers. See http://finger.planetquake.com/

iptables - IP firewall administration (Linux kernel 2.6/2.4) See YoLinux firewall/gateway configurationipchains - IP firewall administration (Linux kernel 2.2) See YoLinux firewall/gateway configuration.

socklist - Display list of open sockets, type, port, process id and the name of the process. Kill with fuser or kill.

host - Give a host name and the command will return IP address. Unlike nslookup, the host command will use both /etc/hosts as well as DNS.     Example: host domain-name-of-server

nslookup - Give a host name and the command will return IP address. Also see Testing your DNS (YoLinux Tutorial) Note that nslookup does not use the /etc/hosts file.

 

4, Linux TCP/IP Network Configuration Files:

/etc/resolve.conf      List DNS servers for internet domain name resolution.     Manual page for: /etc/resolv.conf

/etc/hosts            Lists hosts to be resolved locally (not by DNS).      Manual page for: /etc/hosts 

/etc/nsswitch.conf      List order of host name search. Typically look at local files, then NIS server, then DNS server.     

Red Hat/Fedora/CentOS: /etc/sysconfig/network        Specify network configuration. eg. Static IP, DHCP, NIS, etc.

Red Hat/Fedora/CentOS: /etc/sysconfig/network-scripts/ifcfg-device       Specify TCP network information.

Ubuntu/Debian: /etc/network/interfaces      Specify network configuration and devices. eg. Static IP and info, DHCP, etc.

 

5, Fedora / Red Hat Network GUI Configuration Tools:

TCP/IP ethernet configuration:

    Network configuration:    /usr/sbin/system-config-network (FC-2/3)   /usr/bin/redhat-config-network (/usr/bin/neat) (RH 7.2+ FC-1)

    Text console configuration tool:  /usr/sbin/system-config-network-tui   Fedora Core 2/3  /usr/bin/redhat-config-network-tui

     Text console network configuration tool.    First interface only - eth0: /usr/sbin/netconfig

   

6, Assigning an IP address:

Command Line:

    /sbin/ifconfig eth0 192.168.10.12 netmask 255.255.255.0 broadcast 192.168.10.255

 Manually add the network configuration to /etc/sysconfig/network-scripts/ifcfg-eth0 (Red Hat/Fedora/CentOS) for the first NIC,ifcfg-eth1 for the second, etc,

  /etc/sysconfig/network-scripts/ 

/etc/sysconfig/network
/etc/sysconfig/networking/

/etc/sysconfig/network-scripts/    script

 

7, Adding a network interface card (NIC):

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值