




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Linux中与网络配置有关的文件 /etc/hosts 这个文件是把IP地址和主机名联系起来的简单文件。文件内容如下:# Do not remove the following line, or various programs# that require network functionality will fail.spring localhost.localdomain localhost主机别名主机别名主机名IP地址#号开头为注释 /etc/services记录着端口号和服务之间的对应关系,这个文件不需要修改。文件内容如下# /etc/services:# $Id: services,v 1.32 2003/01/09 17:56:30 dwalsh Exp $# Network services, Internet style# Note that it is presently the policy of IANA to assign a single well-known# port number for both TCP and UDP; hence, most entries here have two entries# even if the protocol doesnt support UDP operations.# Updated from RFC 1700, Assigned Numbers (October 1994). Not all ports# are included, only the more common ones.# The latest IANA port assignments can be gotten from#/assignments/port-numbers# The Well Known Ports are those from 0 through 1023.# The Registered Ports are those from 1024 through 49151# The Dynamic and/or Private Ports are those from 49152 through 65535# Each line describes one service, and is of the form:# # service-name port/protocol aliases . # commenttcpmux1/tcp# TCP port service multiplexertcpmux1/udp# TCP port service multiplexerrje5/tcp# Remote Job Entryrje5/udp# Remote Job Entryecho7/tcpecho7/udpdiscard9/tcpsink nulldiscard9/udpsink null /etc/sysconfig/network 这个文件可以配置一些基本的网络信息。如主机名、网关。文件内容如下:NETWORKING=yes 是否需要配置网络,值是yes或no ,一般为yes.HOSTNAME=spring 主机名,要更改主机名可以修改此项,重启后生效。GATEWAY=54 配置主机的网关 /etc/host.conf 指定主机进行域名解析时的查找顺序。order hosts,bind先找hosts文件,再使用bind服务(bind为linux下的DNS服务程序),如果配置了DNS,可以改与order bind,hosts关键字,意思是顺序 /etc/nsswitch.conf是由SUN公司开发的,用于管理系统中多个配置文件查找顺序,比/etc/host.conf功能多,我们一般不使用。文件内容如下:# /etc/nsswitch.conf# An example Name Service Switch config file. This file should be# sorted with the most-used services at the beginning.# The entry NOTFOUND=return means that the search for an# entry should stop if the search in the previous entry turned# up nothing. Note that if the search failed due to some other reason# (like no NIS server responding) then the search continues with the# next entry.# Legal entries are:#nisplus or nis+Use NIS+ (NIS version 3)#nis or ypUse NIS (NIS version 2), also called YP#dnsUse DNS (Domain Name Service)#filesUse the local files#dbUse the local database (.db) files#compatUse NIS on compat mode#hesiodUse Hesiod for user lookups#NOTFOUND=returnStop searching if not found so far# To use db, put the db in front of files for entries you want to be# looked up first in the databases# Example:#passwd: db files nisplus nis#shadow: db files nisplus nis#group: db files nisplus nispasswd: filesshadow: filesgroup: files#hosts: db files nisplus nis dnshosts: files dns# Example - obey only what nisplus tells us.#services: nisplus NOTFOUND=return files#networks: nisplus NOTFOUND=return files#protocols: nisplus NOTFOUND=return files#rpc: nisplus NOTFOUND=return files#ethers: nisplus NOTFOUND=return files#netmasks: nisplus NOTFOUND=return files bootparams: nisplus NOTFOUND=return filesethers: filesnetmasks: filesnetworks: filesprotocols: filesrpc: filesservices: filesnetgroup: filespublickey: nisplusautomount: filesaliases: files nisplus /etc/resolv.conf 这个文件记录着域名服务器的位置。文件内容如下:nameserver 54 最多写三个 /etc/sysconfig/network-scrips/ifcfg-eth0DEVICE=eth0 设备名称BOOTPROTO=static IP地址等信息是如何获得,可以是static或dhcpBROADCAST=55 广播地址,BOOTPROTO=static时使用此项IPADDR=06 IP地址,BOOTPROTO=static时使用此项NETMASK= 子网掩码, BOOTPROTO=static时使用此项NETWORK= 网络地址,BOOTPROTO=static时使用此项ONBOOT=yes 计算机启动时是否启动网卡,值是yes或noUSERCTL=no 除root外,其他用户是否可以控制该设备GETWAY=54 默认网关Linux中与网络有关的脚本文件 /etc/rc.d/init.d/network/etc/rc.d/init.d/network start 启用网卡/etc/rc.d/init.d/network stop 停用网卡/etc/rc.d/init.d/network restart 重启网卡/etc/rc.d/init.d/network reload 重启网卡/etc/rc.d/init.d/network status 显示网卡的是否启动了也可以用下面命令Service network start|stop|restart|reload|status /etc/syconfig/network-scrips/ifup/etc/syconfig/network-scrips/ifup eth0 启用eth0或 ifup eth0 /etc/syconfig/network-scrips/ifdown/etc/syconfig/network-scrips/ifdown eth0 停用eth0或 ifdown eth0 /sbin/ifconfigifconfig 查看所有网卡的配置信息ifconfig eth0 查看eth0的配置信息ifconfig eth0 up 启用eth0ifconfig eth0 down 停用eth0ifconfig eth0 5 netmask 配置eth0的IP地址和子网掩码,直接生效且不把修改保存到配置文件ifconfig eth0 5 netmask up 配置eth0的IP地址和子网掩码并启用,直接生效且不把修改保存到配置文件 /sbin/netconfignetconfig 用图形界面配置网卡的基本信息 /bin/pingping -c count -i inerval -t ttl -s packetsize destinationping -c 4 i 3 -t 60 s 1500 最多经历60个路由器 ping四次 每三秒发送一个数据包 每个数据包大小为1500字节 /sbin/routeroute add|del|flush -net|-host target netmask gw dev route 查看路由表route add -host 0 eth0 填加到主机的路由route add -host 0 dev eth0 填加到主机的路由route add -host 0 gw 0 填加到主机的路由route del -host 0 删除到主机的路由route add net /24 eth0 填加到网段的路由route add net /24 dev eth0 填加到网段的路由route add net /24 gw 0 填加到网段的路由route add net netmask eth0 填加到网段的路由route add net netmask dev eth0 填加到网段的路由route add net netmask gw 0 填加到网段的路由route del net /24 删除到网段的路由route add default eth0 填加默认网关route add default gw 0 eth0 填加默认网关route add default gw 0 dev eth0 填加默认网关route del default 删除默认网关 /usr/sbin/traceroutetraceroute 主机名 解析目标主机和源主机之间经过别些路由 ADSL配置需要的软件包ppp-2.4.1-10、rp-pppoe-3.5-2/usr/sbin/adsl-setup 配置ADLS/usr/sbin/adsl-stop 挂断/usr/sbin/adsl-start 拨号/usr/sbin/adsl-status 查看状态注意问题:如果不能正确连接,进行后面的操作,删除默认网关和默认路由,并添加新的默认路由route add default ppp0,使用netstat nr查看是否有默认路由。Enter your Login Name (default root): 512632114 此处写从ISP获得的ADSL号INTERFACEEnter the Ethernet interface connected to the ADSL modemFor Solaris, this is likely to be something like /dev/hme0.For Linux, it will be ethX, where X is a number.(default eth0): 此处写连接ADSL的设备名,不填默认是eth0Do you want the link to come up on demand, or stay up continuously?If you want it to come up on demand, enter the idle time in secondsafter which the link should be dropped. If you want the link tostay up permanently, enter no (two letters, lower-case.)NOTE: Demand-activated links do not interact well with dynamic IPaddresses. You may have some problems with demand-activated links.Enter the demand value (default no): 是否自动断线。DNSPlease enter the IP address of your ISPs primary DNS server.If your ISP claims that the server will provide dynamic DNS addresses,enter server (all lower-case) here. 首选域名服务器地址If you just press enter, I will assume you know what you aredoing and not modify your DNS setup.Enter the DNS information here: Please enter the IP address of your ISPs secondary DNS server.If you just press enter, I will assume there is only one DNS server.Enter the secondary DNS server address here: 备用DNS服务器PASSWORDPlease enter your Password: 12345678 输入ADSL登录密码Please re-enter your Password: 12345678 重新输入登录ADSL密码USERCTRLPlease enter yes (two letters, lower-case.) if you want to allownormal user to start or stop DSL connection (default yes): no 是否允许其他人控制ADSL,默认是允许。FIREWALLINGPlease choose the firewall rules to use. Note that these rules arevery basic. You are strongly encouraged to use a more sophisticatedfirewall setup; however, these will provide basic security. If youare running any servers on your machine, you must choose NONE andset up firewalling yourself. Otherwise, the firewall rules will denyaccess to all standard servers like Web, e-mail, ftp, etc. If youare using SSH, the rules will block outgoing SSH connections whichallocate a privileged source port.The firewall choices are:0 - NONE: This script will not set any firewall rules. You are responsible for ensuring the security of your machine. You are STRONGLY recommended to use some kind of firewall rules.1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway for a LANChoose a type of firewal
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年事业单位工勤技能-江苏-江苏保健按摩师四级(中级工)历年参考题库含答案解析(5套)
- 2025年事业单位工勤技能-广西-广西地图绘制员五级(初级工)历年参考题库含答案解析
- 2025年事业单位工勤技能-广东-广东热处理工一级(高级技师)历年参考题库含答案解析
- 2025年事业单位工勤技能-广东-广东机械热加工四级(中级工)历年参考题库典型考点含答案解析
- 2025年事业单位工勤技能-广东-广东地质勘查员五级(初级工)历年参考题库典型考点含答案解析
- 2025年事业单位工勤技能-广东-广东保育员五级(初级工)历年参考题库含答案解析
- 2020-2025年初级经济师之初级建筑与房地产经济通关题库(附答案)
- 2025年驾驶证考试-客车理论考试-客车驾驶证(科目一)历年参考题库含答案解析(5套)
- 2025年职业技能鉴定-铁路职业技能鉴定-铁路职业技能鉴定(铁路钢轨探伤工)技师历年参考题库含答案解析(5套)
- 2025年职业技能鉴定-铁路职业技能鉴定-变电值班员(初级工)历年参考题库含答案解析(5套)
- GB/T 18029.7-2009轮椅车第7部分:座位和车轮尺寸的测量
- FZ/T 01034-2008纺织品机织物拉伸弹性试验方法
- 《百团大战》历史课件
- 脓毒症诊断和治疗进展课件
- 马克思主义基本原理课件- (全套完整课件)全版
- 【优秀】脑膜瘤护理查房课件
- 初中数学教材解读人教八年级上册(2023年修订)第十三章轴对称等边三角形 导学案
- GB∕T 3480.3-2021 直齿轮和斜齿轮承载能力计算 第3部分:轮齿弯曲强度计算
- 社区居民信息登记卡
- 小金库治理-PPT优秀课件
- 水稳层施工方案(完整版)
评论
0/150
提交评论