搭建Linux閘道器

2021-05-24 13:39:59 字數 1269 閱讀 2580

主要目的:搭建閘道器,使內網能自動獲得ip,並正常訪問外網

作業系統:ubuntu 10.10

需要的軟體有dhcp3-server和firestarter

即 sudo apt-get install dhcp3-server firestarter

eth0為外網網絡卡,eth1為內網網絡卡

下面開始

先開啟/etc/network/inte***ces編輯固定ip,新增

auto eth0

auto eth1

iface eth1 inet static

address 192.168.3.254

netmask 255.255.255.0

開啟/etc/default/dhcp3-server,將inte***ces="″改為inte***ces="eth1″

開啟/etc/dhcpd.conf,將所有內容前都有#,並新增如下內容

# dhcp configuration generated by 小球

ddns-update-style interim; #定義所支援的dns動態更新的型

ignore client-updates; #allow/ignore允許/忽略客戶機更新dns記錄

subnet 192.168.3.0 netmask 255.255.255.0 #定義dhcp服務的子網

range 192.168.3.50 192.168.3.200; #自動分配ip的範圍

option subnet-mask 255.255.255.0;#定義子網掩碼

option routers 192.168.3.254;#定義閘道器

option broadcast-address 192.168.3.255;#定義廣播位址

option domain-name-servers 202.112.20.131,202.114.0.242; #定義dns位址

option domain-name "hustunique.com";#定義網路名字

default-lease-time 21600;#預設的租約時間,單位為秒

max-lease-time 43200;#最長租約時間,單位為秒

若還想配置固定的ip,則可按以下格式新增

host server1

然後再重啟dhcp伺服器就可以了

sudo /etc/init.d/dhcp3-server restart

然後用firestarter這個工具可以簡單的配置iptables的nat功能,只要按照嚮導做很簡單。

搭建zuul閘道器

zuul是netflix開源的乙個api gateway 伺服器,本質上是乙個web servlet應用 filter過濾器 是微服務的請求入口,保護微服務的安全 預設整合ribbon,hystrix。zuul 在雲平台上提供動態路由 實現請求的分發 負載均衡 監控,彈性,安全,鑑權,限流等邊緣服務...

Ocelot 閘道器搭建(一)

依賴專案 net core 2.0 空專案 新增應用設定檔案 ocelot.json 負載均衡 loadbalancer leastconnection 將請求發往最空閒的那個伺服器 roundrobin 輪流傳送 noloadbalance 總是發往第乙個請求或者是服務發現 限流 ratelimi...

Ocelot 閘道器搭建(二)

出處 專案新增進來後的結構如下所示 configureservices服務中ocelot的注入的同時需要注入我們的擴充套件方法,如下所示 services.addocelot 注入ocelot服務 addauthlimitcache option addconsul 我們在資料庫中配置乙個路由吧,如...