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 ...
随机推荐
- C#中标准的IDispose模式
C#实现IDispose接口 .net的GC机制有两个问题:首先GC并不能释放所有资源,它更不能释放非托管资源.其次,GC也不是实时的,所有GC存在不确定性.为了解决这个问题donet提供了析构函 ...
- 测试从应用到DB的准确的网络延迟
最近几大云厂商把底层的基础设施包装起来后,通过Ping等很难知道真正的网络延迟了,因为通过ping还没到db都返回了,如何知道从应用到db的真正网络延迟呢? 用我的脚本 #!/bin/bash m= ...
- [转帖]UID卡、CUID卡、FUID卡、UFUID卡的区别及写入方式
UID卡.CUID卡.FUID卡.UFUID卡的区别及写入方式 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://bl ...
- Win32API文本处理
工程模板:https://www.cnblogs.com/eternalmoonbeam/p/10793080.html 安全的文本输出方式: 需要额外包含头文件strsafe.h 依次使用以下三个函 ...
- 网络 TCP三次握手,四次挥手详解
三次握手,四次挥手可以说是炙手可热的面试题了,来看看它究竟长什么样子吧! 我们先把流程图贴上来 : 为什么这么复杂? 因为TCP是可靠性传输. 确认可靠传输的前提: TCP连接管理机制 用TCP首部 ...
- Android手机的分区以及一些刷机术语的了解
最早以前的手机基本都是下载一个刷机软件(像刷机精灵.刷机大师),一键root,一键刷机,这就以前的傻瓜式刷机,至少我在高中(2015年开始接触)的时候也是这么干的.那时候,好像有种手机开机界面会出现“ ...
- go 读取BMP文件头二进制读取
BMP文件头定义: WORD 两个字节 16bit DWORD 四个字节 32bit package main import ( "encoding/binary" "f ...
- C# vb .net实现扭曲角特效滤镜图像处理
在.net中,如何简单快捷地实现Photoshop滤镜组中的扭曲角效果呢?答案是调用SharpImage!专业图像特效滤镜和合成类库.下面开始演示关键代码,您也可以在文末下载全部源码: 设置授权 第一 ...
- 易百教程人工智能python修正-人工智能数据准备-标记数据
我们已经知道,某种格式的数据对于机器学习算法是必需的. 另一个重要的要求是,在将数据作为机器学习算法的输入发送之前,必须正确标记数据. 例如,如果所说的分类,那么数据上会有很多标记. 这些标记以文字, ...
- webRTC client 源码环境工具配置
以下操作真实实验过,安卓,苹果均可成功 环境 Mac 10.13.6 Xcode 11 翻墙代理:Lantern 专业版 Python 2.7.10 设置 git 代理 #设置git代理 $ git ...