iptables nat-讓linux做為路由器,實現區域網訪問外網
2013.5.15
1. 環境:
ubuntu pc一臺,兩個網絡卡:
eth0:
ip 10.3.1.100
gateway 10.3.1.12
dns 10.3.1.2
eth1:
ip 192.168.1.3
windows pc一臺,
ip 192.168.1.4
2. ubuntu pc的eth0可以訪問外網,eth1與windows pc相連。
可以設定ubuntu pc:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 10.3.1.100
設定windows pc:
ip 192.168.1.4
gateway 192.168.1.3
dns 10.3.1.2
這樣,windows就可以上外網了
2013.5.15
相關推薦
iptables nat-讓linux做為路由器,實現區域網訪問外網
這個東西必須學會,真他媽的搞死我了 2013.5.15 1. 環境: ubuntu pc一臺,兩個網絡卡: eth0: ip 10.3.1.100 gateway 10.3.1.12
Linux C++ 區域網訪問外網ip、埠之iptables配置
第一步:安裝iptables yum install -y iptables yum install -y iptables-services 第二步:配置埠對映 1.將所有網段轉發至路由機公網ip(動態): iptables -t nat -A POSTROUTING -o e
樹莓派安裝samba,實現區域網訪問樹莓派
1. 安裝samba sudo apt-get install samba 2. 修改samba配置, sudo vim /etc/samba/smb.conf 如果目錄下沒有這個檔案,
在wmware esxi 虛擬機器 中 ,centos7 無法訪問外網 問題的解決
在虛擬機器的centos7 系統中,使用yum 下載安裝svn,一直失敗。 錯誤提示資訊為 Cannot find a valid baseurl for repo: updates/7/x86_64 按照這個錯誤提示資訊,在網路上搜索相關解決方案,全部無效! 修改
JAVA+FTP實現跨伺服器獲取檔案,支援區域網和外網
1.FTP服務是filezilla server。 下載地址: https://filezilla-project.org/ 2.filezilla server安裝及配置教程 教程地址: https:
nginx為多個不同的服務做反向代理,實現負載均衡
http { upsteam servicename1 { server 192.168.1.100 : 2345 } upsteam servicename2 { server 192.168.1.101 : 4567
華為路由器,靜態路由
解題思路 路由 詳細 p地址 做出 配置路由器 ace The roc 問題:配置接口IP地址並通過靜態路由、默認路由配置實現全網互通。根據題目,使用華為ensp軟件做出了拓撲圖,並根據題目要求詳細標註了每一個端口需要配置的IP地址以及子網掩碼解題思路 第一步,首先配置好所
(轉)linux sudo 重定向,實現只有系統管理員才有權限操作的文件中寫入信息
shel echo 命令 文件 sudo 命令 方式 符號 iss 字串 chown 眾所周知,使用 echo 並配合命令重定向是實現向文件中寫入信息的快捷方式。 本文介紹如何將 echo 命令與 sudo 命令配合使用,實現向那些只有系統管理員才有權限操作的文件中寫入信
NAT靜態路由內網訪問外網(華為)
color 路由 內網訪問外網 add nat vpd 安全保護 inter 網段 1,實驗名稱:NAT靜態路由內網訪問外網(華為)2,實驗目的:將私有地址轉換為合法的IP地址,並解決IP地址不足的問題,而且還能有效的避免來自網絡外的攻擊。讓內網可以訪問外網,而外網不可以訪
linux學習-----用戶,用戶組管理 網絡設置 ssh服務
家目錄 服務器 位置 系統運行級別 而是 普通用戶 ron eth 但是 Linux自有服務 不需要用戶獨立去安裝軟件的服務 而是當我們系統安裝好之後就可以直接使用的服務(內置) 1.運行模式(運行級別) 在linux中 存在一個進程 init(initialize,
虛擬機nat能ping通內外,無法訪問外網
鄰居 解決 無法 vmnet HR 外網 網絡 網關 centos 環境: centos ip 192.168.188.3VMnet 8 網卡ip 192.168.188.1虛擬網絡網卡 網關 192.168.188.1 ping 192.168.188.1 可以ping
Linux搭建好apache後,只有本地能訪問,局域或外網不能訪問
clas 直接 啟動 emctl 描述 wall 啟動服務 fir 訪問控制 由於防火墻的訪問控制導致本地端口不能被訪問。 解決方法: 1,直接關閉防火墻 systemctl stop firewalld.service #停止防火墻服務 systemctl disab
ECS通過iptables ,配置SNAT代理閘道器,實現區域網上網
場景說明: 本文將介紹如何通過為VPC中Linux系統的ECS例項配置SNAT,實現無公網ECS通過有EIP的伺服器代理訪問公網。 步驟: 1、使用SSH的方法登陸一個已經繫結EIP外網的ECS例項。 2、執行以下命令,開啟IP核心轉發功能。 sed -i 's/net.ipv4.ip_f
Java為後臺,前端ajax訪問後臺請求成功但是進入不到success,反而進入error
html: $.ajax({ type:"POST", url:"http://192.168.43.155:8080/Video/SelectAllUserServlet", async:true, data:{ }, error:function(){ alert("asd"); }, success:
linux下操作svn,實現根據時間段檢視某個指定使用者提交的記錄
svn log -v -r {2018-9-10}:{2018-9-25} | sed -n '/danni/,/--$/ p' 其中: -r {2018-9-10}:{2018-9-25}:通過-r來指定時間段 -v:表示顯示詳細資訊 sed -n '/danni/,/--$/
Linux搭建FTP服務,實現只上傳,不下載
筆者最近收到一個需求,搭建Linux上的Ftp服務,但是隻能上傳,不能下載,且使用者不能跳開Ftp,通過Sftp來獲得檔案。大致看了些網上分享。通過配置,完成這個“奇葩”需求。 首先跳開Ftp,使用Sftp那麼可以通過設定虛擬賬戶來實現。 其次Ftp上只上傳,不下載,那麼通過配置Ft
在VMWare下為CentOS設定靜態IP通過NAT訪問外網
一、背景 安裝好的CentOS系統預設是通過DHCP自動分配地址來共享主機的IP以達到訪問外網的目的,但是因為莫名的原因無法訪問外網。只好改為通過靜態IP的方式訪問外網。 二、操作步驟 2.1 確認開啟相關服務 2.2 設定虛擬機器為NAT模式 選中
Linux上安裝mysql,實現主從複製
MYSQL(mariadb) MariaDB資料庫管理系統是MySQL的一個分支,主要由開源社群在維護,採用GPL授權許可。開發這個分支的原因之一是:甲骨文公司收購了MySQL後,有將MySQL閉源的潛在風險,因此社群採用分支的方式來避開這個風險。MariaDB的目的是完全相容MySQL,包括API和
java做伺服器,android做客戶端,實現資料傳輸
許久未動筆,有個小專案開始動工。 需要用一臺windows電腦做伺服器,在android端與其進行資料交換,實現一些業務。 簡單起見,用java寫這個伺服器,以前沒做過,試試水。很簡單的程式碼,純粹找思路。 伺服器端程式碼: package com.test; impor
Linux下為KVM 配置橋接裝置,給網橋配製ip地址
在安裝一個擁有虛擬化功能的Linux作業系統(此處以CentOS為例),一般我們有兩種方法: 1.在光碟安裝的時候安裝好虛擬化包或者PXE伺服器上配置好虛擬化包 2.手動在沒有安裝虛擬化元件的系統中安裝虛擬化元件 如果我們搭建的環境是必須使用虛擬化的,或者說虛擬化是我們搭建這套環境的主要目的之一,那麼