linux 双网卡共享上网

linux 双路由双网卡公私网访问环境配置 linux 双路由双网卡公私网访问环境配置需求问题结论解决办法:配置多张路由表路由展示 需求 之前碰到一个问题,查了很多地方,现在将解决方法分享出来,希望能帮助到遇到相同问题的人。 实验室有一台HP工作站的机器,有一个公网IP,导师希望布置一些网站,和同学们在任何地方都能通过公网IP连到服务器上,本来很简单的问题,但很坑爹的是通过这个公网IP不能上外网,连什么Mysql,github等都不可以(可... 阅读详情

linux 双网卡共享上网

一、网络拓补结构:
服务器:两网卡的设置:
eth0:202.96.168.100 掩码:255.255.255.0 网关:202.96.168.68 #与 Inte.Net 相联
eth1:192.168.1.1 掩码:255.255.255.0 #与局域网相联
客户机子网段:192.168.1.0/255

二、服务器设置:(这两种方法任选其一即可)
2.1、用NAT方法
在服务器上执行下面几条命令:
echo "1" > /proc/sys.Net/ipv4/ip_forward #打开IP转发,1表示转发;0表示不转发
上面这个命令也可以通过修改/etc/sysctl.conf实现,在文件中加上下面一行:
net.ipv4.ip_forward = 1

其余命令是:
iptables -F

iptables -P INPUT ACCEPT

iptables -P FORWARD ACCEPT

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE #打开NAT

2.2、用网桥方法:
echo "1" > /proc/sys.Net/ipv4/ip_forward
ifconfig eth0 0.0.0.0 up
ifconfig eth1 0.0.0.0 up
brctl addbr br0 #添加一个网桥
brctl addif br0 eth0
brctl addif br0 eth1 #将eth0 eth1加到网桥中去
ifconfig br0 192.168.1.1.Netmask 255.255.255.0 broadcast 192.168.1.255 up #给网桥分配IP地址,如果不做NAT,也不需要远程访问网桥的话,可以不设IP地址,但必须启用网桥(ifconfig br0 up)
route add default gw 202.96.168.68 #如果网桥不需要访问其他机器的话,可以不添加网关。

三、客户机设置:
eth0:192.168.1.10 掩码:255.255.255.0 网关:192.168.1.1

四、iptables命令参考:

iptables命令格式
iptables [-t nat] CMD [chain] [rule-matcher] [-j target]

-t nat:表示操作nat表

CMD:为操作命令

chain:为链名

rule-matcher:为规则匹配器

target:为目标动作

iptables -t nat -F #清除原有的nat表中的规则
iptables -F #清除原有的filter有中的规则
iptables -P FORWARD ACCEPT #缺省允许IP转发

五、配置感想
按照NAT 的方法,很快配置完成,并且可以顺利上网。对于那些对于网络配置没什么特殊要求的用户,可以选用NAT方法,简单实用。

补充:
如果想在代理机器重启后,仍然能够上网,就需要将这些命令写入到某些文件中,具体如下:
在/etc/sysctl.conf文件中加上下面一行,打开ip 转发功能:
net.ipv4.ip_forward = 1

在/etc/rc.local 文件中将其余的命令添加到文件中,例如将下面命令添加进去,实现NAT方式共享上网。
iptables -F
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE #打开NAT
数学建模常用模型10 :数据包络(DEA)分析法(投入产出法) 数据包络分析是评价多输入指标和多输出指标的较为有效的方法,将投入与产出进行比较。它的结果包含的意思有: ①θ=1,DEA有效,表示投入与产出比达到最优 ②θ<1,非DEA有效,表示投入与产出比没有达到最优,一般来说,θ越大说明效果越好。 数据包络分析是通过对投入的指标和产出的指标做了一个线性规划,并且进行变换后,然后根据其线性规划的对偶问题(线性规划对偶问题具有经济学意义),求解这个对... 阅读详情

相关推荐

Windows 10下用vcpkg一键搞定libcurl开发环境(Code::Blocks 20.03配置指南)

本文详细介绍了在Windows 10系统下使用vcpkg工具快速配置libcurl开发环境的完整指南,特别针对Code::Blocks 20.03 IDE进行优化设置。通过vcpkg自动化管理依赖项,简化libcurl的安装与配置过程,帮助开发者高效搭建网络通信功能开发环境,并提供了常见问题解决方案和实际项目中的最佳实践。

weixin_28040125的博客 255

linux启用NAT功能,双网卡共享网络,iptables简单实现

此处研究网络上的教程一大堆,利用iptables增加了很多条规则,但是每个教程还都不太一样,所以自己去研究了下iptables的具体教程,发现网上很多教程都是冗余了很多不相关的指令,真正有用的就是iptables的NAT启用,下面以图示拓扑说一下详细内容。简单来说就是一台linux有两块网卡,比如eth0及eth1,eth0可以正常连接外网,eth1连接内部网络,那么可以通过iptables实现eth1内部网络上的设备共享eth0的网络,即linux充当网关的作用。掩码:255.255.255.0。

qigaohua的博客 2053

Visual Studio 2015 插件开发 从入门到放弃(一)

必需知识:C#和Visual Studio (1)安装 Visual Studio 2015 的时候选择 Visual Studio 扩展性工具(Visual Studio Extensibility Tools)。对于已经安装好 Visual Studio 2015 的小伙伴,可以找VS2015的安装包,或者在程序与功能中找VS2015双击,在VS2015界面中选择 修改,再选择

AncientPeople的博客 2万+

linux多网卡实现内外网互通

IP地址: 设置系统网卡的地址和虚拟机的设置的子网ip要在同一ip段:192.168.207.XXX,但是不能和虚拟机设置的ip地址一样。GATEWAY:内网集群所有的网络通信地址,此ip设置为一个不会用到的ip地址。打开网络和internet设置----》更改适配器选项----》找到虚拟机再操作系统的网络网卡。虚拟机页面---》编辑---》虚拟网络编辑器 --》更改设置 ---》添加网络。右击图标---》属性---》internet协议版本4(TCP/IPv4)---》进行参数设置。

assaaSADAAS的博客 9385

将Matlab程序打包成.exe独立可执行程序

将Matlab程序打包成.exe独立可执行程序,在未安装Matlab的电脑上也能运行Matlab程序。

简简单单的学习笔记,致力于帮助更多前进路上的朋友~ 5万+

STM32外部中断与事件机制深度解析:从硬件触发到软件响应

本文深入解析STM32外部中断与事件机制,从硬件触发到软件响应的完整流程。通过对比中断和事件的应用场景、响应速度及配置方法,帮助开发者优化嵌入式系统设计,特别适合需要低功耗或高实时性的项目。

weixin_29175469的博客 419

linux下双网卡共享上网配置

双网卡共享上网配置 ###环境 主机1: 192.168.1.1(外网)eth0 192.168.0.1(内网)eth1 主机2:192.168.0.2 eth0 ###配置主机1 1.临时开启转发功能 sudo echo "1">/proc/sys/net/ipv4/ip_forward 2.永久开启转发功能 sudo vim /etc/sysctl.conf #永久开启 net.ipv4.ip_forward=1 #去掉注释 sysctl

shuangmu9768的博客 1万+

科研人必备!用WisPaper搭建个人文献知识库的完整指南(附Zotero联动技巧)

本文详细介绍了如何利用WisPaper搭建高效的个人文献知识库,包括文件命名标准化、文件夹结构设计、语义搜索技巧及与Zotero的深度联动方法。通过智能标签系统和知识图谱功能,科研人员可以快速定位关键文献,提升研究效率。特别适合需要管理大量学术文献的研究者。

weixin_30823001的博客 274

Linux下实现双网卡共享上网 ADSL拨号程序

Linux下实现双网卡共享上网 ADSL拨号程序我们用 rp--pppoehttp://www.roaringpenguin.com/pengui...e_rp-pppoe.php下载 rp-pppoe-3.8.tar.gz安装:tar zxvf rp-pppoe-3.8.tar.gzcd rp-pppoe-3.8../go当出现>>> Enter your PPP

fenweixiang的专栏 1211

java技术专家 【DDD(领域驱动设计)思想解读及优秀实践 22】|泛化建模(上):领域知识更抽象怎么办?

java技术专家 【DDD(领域驱动设计)思想解读及优秀实践 22】|泛化建模(上):领域知识更抽象怎么办?

大壮 1169

【Clickhouse】Cannot allocate block number in Zookeeper write prefix view location

我有一个问题,我CK集群跑批的时候,replicated表变成只读的了下面是CK的报错和当时ZK的日志。下面是zk报错开始 我认为是写入的时候,压力太大,ZK扛不住了,就按照博客里的建议优化了ZK的参数,现在偶尔还会只读,zk报错都是图里的那种clickhouse的集群是5分片的集群,数据量比较大。每小时批量一次,每次2-10W条数据,字段的话,不到200个字段,使用的 jdbc sink写入。

九师兄 843

linux认证备考:LINUX系统双网卡共享上网

LINUX系统双网卡共享上网, eth1:192.168.99.26 掩码:255.255.255.0 网关:192.168.99.251 #与 Inte.Net 相联 192.168.99.251为路由器接外网。 一、网络拓补结构: 服务器:两网卡的设置: eth1:192.168.99.26 掩码:255.255.255.0 网关:192.168.99.251 #与

chenliujiang1989的专栏 795

华为MetaERP月结加速方案:并行关账技术深度解析

【摘要】华为MetaERP并行关账技术通过创新架构设计,将传统串行月结流程(8-12小时)优化为并行执行(2-4小时)。关键技术包括:1)基于DAG引擎的任务依赖分析,实现模块/子任务三级并行;2)Saga模式分布式事务保障数据一致性;3)动态资源分配算法提升CPU利用率至60-80%。实施效果显示月结时间缩短70%,成功率提升至99.8%,错误恢复时间减少75%。该方案为大型企业ERP系统提供了高效的月结加速方案,未来还将结合AI调度与混合云扩展持续优化。

金牌架构师 1443

Linux双网卡NAT共享上网

linux双网卡NAT共享上网 术语字汇 私有IP地址(路由不可达地址)是一个被用于本地局域网的IP地址(在互联网中不可见)。 公用IP地址(路由可达地址)是一个在互联网中可见的IP地址。 IP伪装是一项允许一系列机器通过MASQ网关连接互联网的功能。这些MASQ网关之外的机器在互联网中是不可见的。MASQ之后的机器中任何流入或流出的数据必须经过MASQ网关。 网络地址转换(NAT)是一项通过I...

weixin_30876945的博客 412

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

linux双网卡NAT共享上网

linux双网卡NAT共享上网 2012-09-04     0 个评论      作者:shlei收藏  我要投稿 linux双网卡NAT共享上网   一、网络拓补结构:  服务器:两网卡的设置:  eth0:202.96.168.100 掩码:255.255.255.0 网关:202.96.168.68 #与 Inte.Net 相联  eth1:192.168.1.1

yu132563的专栏 825

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

linux 双网卡 NAT共享上网

linux 双网卡共享上网 一、网络拓补结构:服务器:两网卡的设置:eth0:202.96.168.100掩码:255.255.255.0网关:202.96.168.68#与Inte.Net相联eth1:192.168.1.1掩码:255.255.255.0#与局域网相联客户机子网段:192.168.1.0/255二、服务器设置:(这两种方法任选其...

weixin_34363171的博客 111

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

linux服务器 双网卡实现共享上网

LINUX系统双网卡共享上网 IPTABLES和NAT 一、网络拓补结构: 服务器:两网卡的设置: eth1:192.168.99.26 掩码:255.255.255.0 网关:192.168.99.251 #与 Inte.Net 相联 192.168.99.251为路由器接外网。 eth0:192.168.0.1 掩码:255.255.255....

weixin_33795743的博客 382

linux nat和网桥多网卡,linux 双网卡 NAT共享上网

linux 双网卡共享上网一、网络拓补结构:服务器:两网卡的设置:eth0:202.96.168.100掩码:255.255.255.0网关:202.96.168.68#与Inte.Net相联eth1:192.168.1.1掩码:255.255.255.0#与局域网相联客户机子网段:192.168.1.0/255二、服务器设置:(这两种方法任选其一即可)1用NAT方法在服务器上执行下...

weixin_34289350的博客 576

linux双网卡共享上网

      我的主机安装的是fedora 8,kernel为2.6.23.1-42.      双网卡配置如下:      eth0 连接外网,ip为10.0.49.13      eth1 连接内网 192.168.1.0/24网段      还有一台windows的机器,IP为192.168.1.101,与本主机接到同一个switch上,通过本主机来上网,它的网关设为192.1

applesax的专栏 689

手机与linux双网卡共享上网

http://bbs.mfunz.com/thread-79847-1-1.html 手机与linux双网卡共享上网 笔记本电脑通过有线(eth0)接入互联网,现时想设置无线网卡(wlan0)为对等网方式(ad-hoc)与我的ME525共享上网。 一、网络拓补结构:  服务器上的两个网卡设置:  eth0:  192.168.0.100 掩码:255.255.255.0

#ifndefine maxwit #define maxwit...#endif 1395

LINUX系统双网卡共享上网

一、网络拓补结构:     服务器:两网卡的设置:     eth1:192.168.99.26 掩码:255.255.255.0 网关:192.168.99.251 #与 Inte.Net 相联 192.168.99.251为路由器接外网。     eth0:192.168.0.1 掩码:255.255.255.0 #与局域网交换机相联     客户机子网段:192.168.0.

yaxf999的专栏 692

linux下双网卡做主机

前些日子我给笔记本配了一个U口网卡,这是由于寝室没有台式,前些日子好不容易整了一个台式的电脑,可是没有双网卡啊,用网通的时候homeshare,再加之这破windows系统的不稳定,网通老是掉线,昨天我产生了个想法,用我的linux做主机,双网卡全寝室共享上网。这样在linux稳定的支持下,不用任何路由软件就能够实现共享上网。然而在linux下配置双网卡是有一定难度的,一个设计到软

iotplan.com 物联网技术专栏 968
上一篇: 肯·汤普逊-C语言创始人
下一篇: NT下判断用户是否有管理员权限
simonzhao0536
博客等级 码龄15年 6粉丝 10原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值