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.localor 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 argumentI 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 ...
随机推荐
- 西门子PLC1200内使用SCL实现简化版PID算法
西门子自带的PID效果很好,但是会比较吃性能,使用次数有限,很多地方需要PID但不需要这么精准的PID,所以网上找个简单的算法自己调用. 新建数据类型 前三个就是PID三个参数 新建FC块: #PID ...
- kubernetes 监控方案之:heapster+influxdb+grafana(十八)
目录 一.Heapster 介绍 二.部署 三.使用 heapster 已经 deprecated 了:https://github.com/kubernetes/heapster,所以下面的演示主要 ...
- (C#)Application.Exit()、Environment.Exit(0)区别
Application.Exit:通知winform消息循环退出.会在所有前台线程退出后,退出应用 强行退出方式,就像 Win32 的 PostQuitMessage().它意味着放弃所有消息泵,展开 ...
- Feign输出Info级别日志
背景 spring cloud netfix组件中,feign相关的日志默认是不会输出的,需要自定义配置才能输出,并且Feign只对Debug基本的日志做出响应, 实际业务需要输出Info级别的日志, ...
- linux 创建虚拟机常见错误
无法打开内核设备global vmx86 重启虚拟机所有服务 无法创建虚拟机 需要使用管理员身份运行vm即可
- Python知识点图片
- 深度学习Tensorflow相关书籍推荐和PDF下载
深度学习Tensorflow相关书籍推荐和PDF下载 baihualinxin关注 32018.03.28 10:46:16字数 481阅读 22,673 1.机器学习入门经典<统计学习方法&g ...
- WPF 不要给 Window 类设置变换矩阵(应用篇)
原文:WPF 不要给 Window 类设置变换矩阵(应用篇) WPF 的 Window 类是不允许设置变换矩阵的.不过,总会有小伙伴为了能够设置一下试图绕过一些验证机制. 不要试图绕过,因为你会遇到更 ...
- C#中关于常用日期的计算
void Main() { DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays( - Convert.ToInt32( ...
- java之servlet之文件下载
1.在页面中,可以直接通过超链接来下载: a) 如果浏览器能够打开该文件,那么直接在浏览器中显示---不是想要的效果 b) 任何人都能下载,不能进行权限控制 2.通过servlet来进行下载,在ser ...