Route all trafic for specific ip over specific network interface
I have a linux server that needs to get some routing. I'm fairly new at this and i don't find any clear source on google.
The setup should be simple:
All traffic to a server on ip 192.168.72.20 should be sent over interface 3.
All other interfaces don't matter at the moment.
Here you have the output for route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.72.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.72.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.72.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.72.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
192.168.72.0 0.0.0.0 255.255.255.0 U 0 0 0 eth4
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 192.168.72.12 0.0.0.0 UG 0 0 0 eth0
- 1Are you using the old fashioned ifconfig and route command or the modern ip commands? (old ones would be something like
route add -host 192.168.72.20 GW eth3_ip
) – Hennes Mar 29 '13 at 13:48
- i don't know, i guess the old ones, how can i check that? – Frederiek Mar 29 '13 at 13:58
Try:
ip route add 192.168.72.20/32 dev eth3

- 3Just a note: to permanently keep this configuration make sure you add it to
/etc/rc.local
or your distro's equivalent. It won't persist between reboots. – LawrenceC Mar 29 '13 at 16:32 - 1I tried this same format for mapping an IP to the wlan0 on Ubuntu 14.04 and got
RTNETLINK answers: Invalid argument
I had to remove the /** from the IP so I ended up with:sudo ip route add 192.168.50.15 dev wlan0
-- thought I'd mention that in case anyone else ran into this issue. Thank you for your answer ultrasawblade, it was helpful. – mason81 Jul 10 '15 at 14:54
- 3Do not forget
via <gateway_ip>
if the target IP is not directly reachable! – calandoa Dec 4 '17 at 15:00
Route all trafic for specific ip over specific network interface的更多相关文章
- How to block a specific IP Address using UFW
How to block a specific IP Address using UFW The key to blocking a specific IP address with UFW is t ...
- Docker无法启动 Could not find a free IP address range for interface 'docker0' 最方便的解决办法
阿里云的CentOS 6.5上安装Docker会无法启动,如果直接运行docker -d会看到错误提示:Could not find a free IP address range for inter ...
- do from a specific ip
ping -S 192.168.240.1 sohu.com telnet -b 192.168.240.1 sohu.com 80
- VIP - virtual IP address
virtual IP address (虚拟 IP 地址)1.是集群的ip地址,一个vip对应多个机器2.与群集关联的唯一 IP 地址 see wiki: A virtual IP address ( ...
- TCP/IP Protocol Architecture
原文: https://technet.microsoft.com/en-sg/library/cc958821.aspx 1. 主机到网络层 2.网络互连层(互连这个翻译好) ----------- ...
- Ubuntu中设置静态IP和DNS
在Ubuntu中设置静态IP共两步:1>设置IP:2>设置DNS1>设置IP 编辑 /etc/network/interface文件: sudo vi /etc/n ...
- Java获取ip地址的几种方法
以下内容介绍下java获取ip地址的几种思路. 1.直接利用java.net.InetAddress类获取,不过这种方法只在windows环境下有效,在linux环境下只能获取localhost地址( ...
- Ubuntu中设置静态IP和DNS(转载)
原文地址:http://blog.sina.com.cn/s/blog_669421480102v3bb.html VMware 中使用网络,对虚拟机设置静态IP:在Ubuntu中设置静态IP共两步: ...
- 树莓派(Debian)系统设置了静态IP之后还会获取动态IP的问题解决(scope global secondary eth0)
解决方法: 1.配置好静态IP在/etc/network/interface 2.关闭dhcp服务(不知道这个服务是干嘛的,明明是客户端还需要这个) sudo systemctl stop dhcpc ...
随机推荐
- Oracle ROWNUM的陷阱
先抛出一个问题: 我有一张表T,现在我想对表中1/4的记录作UPDATE操作,我的SQL如下: Update t set col1='123' where mod(rownum,4)=1 我能够得到想 ...
- 不一样的go语言-go缺少的语言特性
相信很多从其他语言转向go语言的人,或者是几乎所有初学go语言的人(我相信目前还没有学校将go作为教学语言,所以未来的IT工程师的第一语言都不会是go),都会在学习的过程中将go与自己的第一语言. ...
- 按键消抖——task任务和仿真平台搭建
一.按键抖动原理 按键抖动原理:按键存在一个反作用弹簧,因此当按下或者松开时均会产生额外的物理抖动,物理抖动会产生电平的抖动. 消抖方法:一般情况下,抖动的总时间会持续20ms以内,按下按键后,等20 ...
- Java性能调优—— VisualVM工具基本使用及监控本地和远程JVM进程超详细使用教程
- [洛谷P2056][ZJOI2007]捉迷藏(2019-7-20考试)
题目大意:有一棵$n(n\leqslant10^6)$个点的树,上面所有点是黑点,有$m$次操作: $C\;u$:把点$u$颜色翻转 $G$:问树上最远的两个黑点的距离,若没有黑点输出$0$ 题解:有 ...
- GRE
第一个技术是GRE,全称Generic Routing Encapsulation,它是一种IP-over-IP的隧道技术.它将IP包封装在GRE包里,外面加上IP头,在隧道的一端封装数据包,并在通路 ...
- 缺陷的背后(三)---mysql之sql_mode为空的陷阱
导语 mysql服务器可以在不同的sql_mode模式下运行,并且可以根据sql_mode系统变量的值,为不同的客户机应用不同的模式.sql_mode会影响mysql支持的sql语法,并且会执行数据验 ...
- .NET/C# 阻止屏幕关闭,阻止系统进入睡眠状态
原文:.NET/C# 阻止屏幕关闭,阻止系统进入睡眠状态 在 Windows 系统中,一段时间不操作键盘和鼠标,屏幕便会关闭,系统会进入睡眠状态.但有些程序(比如游戏.视频和演示文稿)在运行过程中应该 ...
- Thomas Brinkhoff 基于路网的移动对象生成器的使用[第二版]
Thomas Brinkhoff 基于路网的移动对象生成器的使用 Thomas Brinkhoff 基于路网的移动对象生成器的使用 相关操作的说明 相关文件的说明 运行 导入eclipse后运行时选择 ...
- MVC比WebForm的优势,为什么使用MVC
前言 如果你看了最近微软的议程,你会发现他们现在的焦点除了MVC,还是MVC.问题在于为什么微软如此热衷于丢弃传统的APS.NET Webform而转向ASP.NET MVC?本文就主要来讨论这个问题 ...