1 / 33

Linux 操作系统 网络管理

Linux 操作系统 网络管理. 周炯 上海艾基信息技术有限公司. 内容简介. 1 C/S 模型 2 路由管理 3 ppp 配置 4 VPN. 1 C/S 模型. C/S 介绍 守护进程 xinetd RPC. 1 xinetd 守护进程.

Download Presentation

Linux 操作系统 网络管理

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux操作系统网络管理 周炯 上海艾基信息技术有限公司 Acegene IT Co. Ltd.

  2. 内容简介 • 1 C/S模型 • 2 路由管理 • 3 ppp 配置 • 4 VPN Acegene IT Co. Ltd.

  3. 1 C/S模型 • C/S介绍 • 守护进程xinetd • RPC Acegene IT Co. Ltd.

  4. 1 xinetd守护进程 • xinetd(eXtendedInterNETservicesdaemon)提供类似于inetd+tcp_wrapper的功能,但是更加强大和安全。它能提供以下特色:*支持对tcp、ucp、RPC服务(但是当前对RPC的支持不够稳定)*基于时间段的访问控制*功能完备的log功能,即可以记录连接成功也可以记录连接失败的行为*能有效的防止DoS攻击(DenialofServices)*能限制同时运行的同意类型的服务器数目*能限制启动的所有服务器数目*能限制log文件大小*将某个服务绑定在特定的系统接口上,从而能实现只允许私有网络访问某项服务*能实现作为其他系统的代理。如果和ip伪装结合可以实现对内部私有网络的访问 它最大的缺点是对RPC支持的不稳定性,但是可以启动protmap,与xinetd共存来解决这个问题 Acegene IT Co. Ltd.

  5. 1 编译安装 • www.xinetd.org下载xinetd • configure 选项: • --with-libwrap:根据tcpd配置文件(/etc/hosts.{allow,deny})来进行访问控制 • --with-loadavg:在系统负载过重时关闭某些服务进程,来实现某些DoS攻击。 • --with-inet6:使用该选项xinetd将支持IPv6 Acegene IT Co. Ltd.

  6. 1 配置文件 配置方式: /etc/xinetd.conf 和 /etc/xinetd.d 基本格式: Service service_name { .. } 其中是属性表,每个属性可指定一个值,使用=,部分属性支持+=,-=实现在原有的基础上加、减某值。 Acegene IT Co. Ltd.

  7. 1 servers • 实现提供当前运行在服务器上的进程表 ,以及有关这些进程的确切信息 ,如: • Serviceservers{type=INTERNALUNLISTEDSocket_type=streamProtocol=tcpPort=9997Wait=noOnly_from=172.17.33.111Wait=no} Acegene IT Co. Ltd.

  8. 1 Services • services特定项的目的是提供可用服务的列表 • Serviceservices{type=INTERNALUNLISTEDSocket_type=streamprotocol=tcpport=8099wait=noOnly_from=topcat} Acegene IT Co. Ltd.

  9. 1 Xadmin • 这个特定服务项提供以交互方式获得services特定服务所提供信息的方法 • Servicexadmin{type=INTERNALUNLISTEDsocket_type=streamprotocol=tcpport=9967wait=noOnly_from=topcat} Acegene IT Co. Ltd.

  10. 2 Linux路由实现 • 路由器简介 • 用Linux主机作静态路由 • 用GateD实现动态路由 Acegene IT Co. Ltd.

  11. 2 路由器简介 • 路由器的基本概念 • 路由器的原理与作用 • 路由器的功能 • Linux的路由种类 Acegene IT Co. Ltd.

  12. 路由器的基本概念 • 路由和路由器 • 路由器和交换机的区别 • 路由器的分类:硬路由器和软路由器 Acegene IT Co. Ltd.

  13. 路由器的原理与作用 • 路由选路的方式有两种:静态(Static)路由和动态(Dynamic)路由 。 Acegene IT Co. Ltd.

  14. 静态路由 • 静态路由是指从每一个源地址到目的地址的传输都具有固定的路径。一般是根据网络的配置情况,预先添加到路由表里的。如果网络设置发生了变化不会自动更新,需要手动进行更改。 Acegene IT Co. Ltd.

  15. 动态路由 • 常用的动态路由协议 : • RIP协议 • OSPF协议 • BGP协议 Acegene IT Co. Ltd.

  16. 路由器的功能 • 数据转发 • 路由选择 • 协议转换 • 多种协议的路由选择 • 流量控制 • 分段和组装功能 • 网络管理功能 Acegene IT Co. Ltd.

  17. Linux的路由种类 • 1.在局域网和外部网之间进行数据包转发 。 • 2.分割子网并实现各个逻辑子网间数据包的转发。 • 3.用普通PC机来作通常意义上的路由器,也就是架设软路由器。 Acegene IT Co. Ltd.

  18. 硬件准备——实例(网络拓扑图 ) Acegene IT Co. Ltd.

  19. 设置服务器IP地址 • eth0设置外部网络的IP地址 ,其余四个网络接口分别设置如下内部IP地址: • # ifconfig eth0 202.38.85.10 netmask 255.255.255.0 broadcast 202.38.85.255 • # ifconfig eth1 192.168.1.1 netmask 255.255.255.192 broadcast 192.168.1.64 • # ifconfig eth2 192.168.1.65 netmask 255.255.255.192 broadcast 192.168.1.128 • # ifconfig eth3 192.168.1.129 netmask 255.255.255.192broadcast 192.168.1.192 • # ifconfig eth4 192.168.1.193 netmask 255.255.255.192broadcast 192.168.1.255 • 或编辑/etc/sysconfig/network-scripts/目录下的启动脚本文件 。 Acegene IT Co. Ltd.

  20. 设置路由 • # route add -net 202.38.85.0 netmask 255.255.255.0 dev eth0 • #route add -net 192.168.1.0 netmask 255.255.255.192 dev eth1 • #route add -net 192.168.1.64 netmask 255.255.255.192 dev eth2 • #route add -net 192.168.1.128 netmask 255.255.255.192 dev eth3 • # route add -net 192.168.1.192 netmask 255.255.255.192 dev eth4 • 最后指定默认网关 : • # route add default gw 202.38.85.1 Acegene IT Co. Ltd.

  21. 配置客户端和检测路由设置 • 1.在一个子网内的一台客户机上,检测能否连通本子网的网关。 • 2.在一个子网内的一台客户机上,检测能否连通另一个子网的网关。 • 3.在一个子网的一台客户机上,检测是否能够连通另一个子网内的一台客户机。 • 4.最后在一个子网的一台客户上,检测是否能够连通外部网络。 Acegene IT Co. Ltd.

  22. 用GateD实现动态路由 • GateD简介 • 配置GateD实现RIP Acegene IT Co. Ltd.

  23. GateD简介 • GateD是一个基于路由协议之间交换信息产生的路由数据库,来处理动态路由的软件。它采用了模块化的设计,包括核心服务程序、路由信息数据库、以及多种协议的支持模块。GateD支持的路由协议主要有:RIP、DCN HELLO、OSPF、EGP和BGP。GateD最初是被用来连接NSFNET(美国国家科学基金会NSF资助的关于主干网)网络之间的交界区域。 Acegene IT Co. Ltd.

  24. rip简介 • rip报文类型: • 请求报文:查询相邻RIP设备,获得它们的距离向量表 • 响应报文:公告它的本地距离向量表中的信息 • 在以下情况下发出: • 每隔30秒发送一次 • 对另一个RIP结点产生的请求报文的响应 • 如果支持触发式,则在本地距离向量表发生变化时被发出。 • RIP使用520端口发送和接收,每个数据报最大为512字节 Acegene IT Co. Ltd.

  25. rip分类 • rip-1: • rip-2: • 支持CIDR和VLSM • 支持组播 • 支持认证 • 支持rip-1 • rippng: • 支持IPV6的认证 • 支持IPV6地址 • 使用521端口 • RIP协议缺点: • 路径代价限制和收敛时间长 Acegene IT Co. Ltd.

  26. Rip配置 • rip yes |no|off [ { • broadcast; • nobroadcast; • nocheckzero; • preference preference; • defaultmetric metric; • query authentication [none|[[simple|md5]paswd]]; • interface interface_list • [noripin]|[ripin] • [noripout]|[ripout] • [metricin metric] • [version1]|[version2[multicast|broadcast]] • [[secondary]authentication[none|[[simple|md5]password]]; • trustedgateways gateway_list; • sourcegateways gateway_list; • traceoptions trace_options; • }]; Acegene IT Co. Ltd.

  27. Gated.conf配置 • Broadcast:指定rip包被广播发送 • Nobroadcast:在绑定的接口上不广播rip包 • Nocheckzero:指定rip不处理RIP包中的保留域 • Preference [n]:设置rip路由的preference,默认为100 • Metric [n]:尺度(默认为16) • Query authentication:设置身份认证方式 • Interface interface_list:针对接口进行参数设定 • Trustedgateways gateway_list:定义接收更新包的网关 • Sourcegateways gateway_list:直接发送rip的路由器列表 • Traceoptions trace_options:设置RIP跟踪选项 Acegene IT Co. Ltd.

  28. INTERFACE_LIST选项 • noripin:忽略指定接口接收到的RIP包 • ripin:默认的设置参数 • noripout:指定接口上不向外发送rip包 • ripout:默认的设置参数 • metricin metric:加入核心路由表前,增加的尺度 • metricout metric:在指定的接口发出rip包前,增加的尺度 • version 1:发送第一个版本的rip协议的数据包 • version 2:指定发送第二个版本的rip 协议的数据包。 • multicast:在指定接口上的发送第二版本的RIP包用组播方式 • broadcast:指定在特定的接口上,使用广播方式来发送 Acegene IT Co. Ltd.

  29. 配置GateD实现RIP • rip yes { • broadcast ; • defaultmetric 5 ; • interface eth1 version 2 multicast ; • } ; • static { • default gateway 202.38.85.1 preference 140 retain ; • } ; Acegene IT Co. Ltd.

  30. 3 ppp • http://www.samba.org/ppp/ • http://www.roaringpenguin.com/penguin/open_source_rp-pppoe.php • 一、编译内核要建立PPPOE服务器,除了内核要支持PPP以外还需要内核支持PPPOE,不过在2.4.18里需要打开内核的不成熟代码才可以选择,内核的配置如下:code maturity level options——>[*] prompt for development and/or incomplete code/driversnetworking options——>[*] packet socket[*] packet socket:mmapped ionetwork device support——>[*] ppp (point-to-point protocol) support[*] ppp multilink support (experimental)[*] ppp filtering[*] ppp support for async serial ports[*] ppp support for sync tty ports[*] ppp deflate compression[*] ppp bsd-compress compression[*] ppp over Ethernet (experimental)character devices——>[*] non-standard serial port support[*] hdlc line discipline support编辑/etc/modules.conf,加入以下几行:• alias char-major-108 ppp_generic• alias /dev/ppp ppp_generic• alias tty-ldisc-3 ppp_async• alias tty-ldisc-13 n_hdlc• alias tty-ldisc-14 ppp_synctty• alias ppp-compress-21 bsd_comp• alias ppp-compress-24 ppp_deflate• alias ppp-compress-26 ppp_deflate Acegene IT Co. Ltd.

  31. 3 ppp • 使用configure•使用make编译PPPD,这里有几个参数比较重要,要支持windows的客户端,应该在编译时加上选项USE_MS_DNS=1,如果你的系统shadow的话,你应该使用make HAS—SHADOW=1表示支持shadow密码•编译完成后,将生成pppd、pppdump、chat和pppstats这几个文件,使用make install安装这些文件启动PPPOE进程:pppoe-server –L 10.0.0.1 –R 10.0.0.2 –N 64 -u-L: 指定PPPOE服务器的IP地址-R: 指定PPPOE拨入服务器分配给客户端的IP地址段-N: 允许客户端同时拨入的数量(默认是64 最大是65534)修改/etc/ppp/options,查看有没有以下几行,没有就加进去:localrepaire-pap loginauth defaultroute hide-passwordipcp-accept-local ipcp-accept-remote 10.0.0.1:10.0.0.255 netmask 255.255.255.0ms-dns 10.0.0.1 修改/etc/ppp/pppoe-server-options,将所有的行都注释掉添加用户到/etc/ppp/pap-secrets中,例如添加用户test,密码为123456,允许从任何位置拨入:#client server secret ip addressestest * “123456” * Acegene IT Co. Ltd.

  32. 4 vpn • freeswan • www.freeswan.org Acegene IT Co. Ltd.

  33. Q & Q U E S T I O N S A N S W E R S A

More Related