熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

ADSL+RH8.0透明網關指南

2022-06-13   來源: Oracle 

  一) 概述:
  利用RH實現透明網關
  
  內部網絡機器的IP地址將由網關所在機器自動分配
  
  (二) 硬件設備:
  ISP VDSL MODEM(以太網口MEDEM)一個(其他ADSL也應該可以)
  M/M自適應以太網卡兩個最好找RH能自動識別的網卡
  
  (三) 操作系統:
  RedHat全部安裝
  
  (四) 配置者身份:
  root
  
  (五) 配置過程:
  啟動系統設置中RedHat的互聯網配置向導
  
  
  選擇xDSL設備
  前進到DSL配置
  網卡設備選擇與VDSL MODEM相連的網卡提供者名稱隨便寫賬號和密碼用ISP給的信息
  
  前進到完成界面
  直接選擇應用完成VDSL的設置
  
  此時出現網絡設備配置工具
  也可以在開始菜單中選擇該工具
  
  配置eth
  配置eth
  
  靜態IP是該局域網內的網關默認網關由ISP提供或者從windows撥號屬性中獲得(DOS命令為: ipconfig /all )
  Linux下用ifconfig獲得 如下PtP:後面的就是你ISP的網關
  ppp Link encap:PointtoPoint Protocol
  inet addr: PtP: Mask:
  配置DHCPD使內部網絡機器自動獲得IP地址
  修改/etc/nf 修改後如下:
  
  #Start of /etc/nf
  ddnsupdatestyle interim;
  ignore clientupdates;
  subnet netmask {
  # default gateway
  option routers ;
  option subnetmask ;
  option nisdomain ;
  option domainname ;
  # option domainnameservers ISPs DNSISPs DNS;
  option domainnameservers ;
  option timeoffset ; # Eastern Standard Time
  # Selects pointtopoint node (default is hybrid) Dont change this unless
  # you understand Netbios very well
  # option netbiosnodetype ;
  range dynamicbootp ;
  defaultleasetime ;
  maxleasetime ;
  }
  #End of /etc/nf
  
  不要把放在動態獲取ip范圍內就可以了
  正確的應該如上: range dynamicbootp ;
  
  修改/etc/sysconfig/iptables(把原有的內容都刪除)修改完如下以使VDSL和代理在開機時自動生效
  
  # Generated by iptablessave va on Tue Oct ::
  *mangle
  :PREROUTING ACCEPT [:]
  :INPUT ACCEPT [:]
  :FORWARD ACCEPT [:]
  :OUTPUT ACCEPT [:]
  :POSTROUTING ACCEPT [:]
  COMMIT
  # Completed on Tue Oct ::
  # Generated by iptablessave va on Tue Oct ::
  *nat
  :PREROUTING ACCEPT [:]
  :POSTROUTING ACCEPT [:]
  :OUTPUT ACCEPT [:]
  [:] A POSTROUTING o ppp j MASQUERADE
  COMMIT
  # Completed on Tue Oct ::
  # Generated by iptablessave va on Tue Oct ::
  *filter
  :INPUT ACCEPT [:]
  :FORWARD ACCEPT [:]
  :OUTPUT ACCEPT [:]
  COMMIT
  # Completed on Tue Oct ::
  
   修改/etc/nf把netipvip_forward設置成如下
  netipvip_forward =
  如此一來每次你重新啟動機器或重新啟動網絡服務(/etc/initd/network restart)時就會自動啟動ip轉發功能!
  
  關閉ipchain自動啟動服務開啟iptables自動啟動服務(如果已經設定可以忽略這步)
  輸入以下命令行:
  [jackey@localhost jackey]$ su
  Password:
  [root@localhost jackey]# cd /etc/initd/
  [root@localhost initd]# chkconfig del ipchains level
  [root@localhost initd]# chkconfig add iptables level
  
  
  重啟機器進入系統後檢查是否正確啟動VDSL
  
  ()ifconfig 看ip地址是否正確結果如下:
  [jackey@localhost jackey]$ ifconfig
  eth Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
  UP BROADCAST RUNNING MULTICAST MTU: Metric:
  RX packets: errors: dropped: overruns: frame:
  TX packets: errors: dropped: overruns: carrier:
  collisions: txqueuelen:
  RX bytes: ( Mb) TX bytes: ( Mb)
  Interrupt: Base address:x
  
  eth Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
  inet addr: Bcast: Mask:
  UP BROADCAST RUNNING MULTICAST MTU: Metric:
  RX packets: errors: dropped: overruns: frame:
  TX packets: errors: dropped: overruns: carrier:
  collisions: txqueuelen:
  RX bytes: ( Mb) TX bytes: ( Mb)
  Interrupt: Base address:x
  
  lo Link encap:Local Loopback
  inet addr: Mask:
  UP LOOPBACK RUNNING MTU: Metric:
  RX packets: errors: dropped: overruns: frame:
  TX packets: errors: dropped: overruns: carrier:
  collisions: txqueuelen:
  RX bytes: ( Kb) TX bytes: ( Kb)
  
  ppp Link encap:PointtoPoint Protocol
  inet addr: PtP: Mask:
  UP POINTOPOINT RUNNING NOARP MULTICAST MTU: Metric:
  RX packets: errors: dropped: overruns: frame:
  TX packets: errors: dropped: overruns: carrier:
  collisions: txqueuelen:
  RX bytes: ( Mb) TX bytes: ( Mb)
  
  其中XX:XX:XX:XX:XX:XX是你網卡的物理地址
  
  ()route n 看路由是否正確結果如下:
  [jackey@localhost jackey]$ route n
  [b]Kernel IP routing table
  [b]Destination Gateway Genmask Flags Metric Ref Use Iface
   UH ppp
   U eth
   U lo
   UG ppp
  
  ()iptables t nat L n 看代理規則是否正確結果如下:
  [root@localhost jackey]# iptables t nat L n
  Chain PREROUTING (policy ACCEPT)
  target prot opt source destination
  
  Chain POSTROUTING (policy ACCEPT)
  target prot opt source destination
  MASQUERADE all / /
  
  Chain OUTPUT (policy ACCEPT)
  target prot opt source destination
  
  ()cat /proc/sys/net/ipv/ip_forward 看值是否為結果如下:[/b]
  [jackey@localhost jackey]$ cat /proc/sys/net/ipv/ip_forward
  
  
  
  
  
  
  
  
  
  
  
  

From:http://tw.wingwit.com/Article/program/Oracle/201311/17825.html
  • 上一篇文章:

  • 下一篇文章:
  • Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.