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 ...
随机推荐
- fiddler 捕捉不到代码发出去的HTTP请求
检查代码里是不是把代理设置为空了,null. 或是通过.config文件禁用了代理.
- SpringBoot 跨域 Access-Control-Allow-Origin
跨域(CORS)是指不同域名之间相互访问. 跨域,指的是浏览器不能执行其他网站的脚本,它是由浏览器的同源策略所造成的,是浏览器对于JavaScript所定义的安全限制策略. 只要协议,子域名,主域名, ...
- socket-01
对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端
- 测试从应用到DB的准确的网络延迟
最近几大云厂商把底层的基础设施包装起来后,通过Ping等很难知道真正的网络延迟了,因为通过ping还没到db都返回了,如何知道从应用到db的真正网络延迟呢? 用我的脚本 #!/bin/bash m= ...
- QML 下拉列表框的使用
世界上一成不变的东西,只有"任何事物都是在不断变化的"这条真理. -- 斯里兰卡 ComboBox { id:combox x: structureTab_label2.x+str ...
- new/delete与命名空间
目录 1. new/delete 2. 命名空间 1. new/delete C++中的动态内存分配 C++通过new关键字进行动态内存申请 C++中的动态内存申请是基于类型进行的 delete关键字 ...
- 微信小程序的登入与授权
官方文档:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html 小程序登录 小程序可以通 ...
- REST framework之分页组件
REST framework之分页组件 一 简单分页 查看第n页,每页显示n条 from rest_framework.pagination import PageNumberPagination # ...
- JavaScript Web API 全选反选案例
全选反选 全选和反选功能,在开发中可以说是应用得非常多的,以下通过案例分解,学习如何使用JS实现全选反选功能. 该功能可分为如下三大步骤: 1.全选 1.1 获取父checkbox,注册点击事件 1. ...
- Springboot 结合百度IORC实现自定义模板图片识别
前言: 首先呢,最近再公司的项目当中遇到这样的一个问题,就是需要识别图片,提取图片当中的关键语句,而且识别的语句当然是人家手写体识别,翻来覆去一想,最终还是决定使用百度的OCR帮助我解决这一项需求 话 ...