如何在Mininet中修改host的IP地址

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在Mininet中修改host的IP地址相关的知识,希望对你有一定的参考价值。

参考技术A I got it! do like this:
mininet> py h1.setIP('10.0.0.3/24')
mininet> py h2.setIP('10.0.0.4/24')
mininet> h1 ping h2
PING 10.0.0.4(10.0.0.4)56(84) bytes of data.
64 bytes from10.0.0.4: icmp_req=1 ttl=64 time=2.38 ms

On Sunday, March 30, 2014 2:15:13 AM UTC+8, Yong Wang wrote:
Hi everyone,

When I change host's IP, other hosts cannot ping through it, but it can ping other host.
And I find that, when typing in dump command, it shows that the IP is not changed.
That's why? How can I really change the ip of virtual host?

mininet> h1 ifconfig h1-eth0 10.0.1.1
mininet> h1 ifconfig
h1-eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:01
inet addr:10.0.1.1 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::200:ff:fe00:1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1543 errors:0 dropped:1302 overruns:0 frame:0
TX packets:185 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:101016 (101.0 KB) TX bytes:13746 (13.7 KB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:336 (336.0 B) TX bytes:336 (336.0 B)
mininet> dump
<RemoteController c0: 192.168.56.1:6633 pid=1891>
<OVSSwitch s3: lo:127.0.0.1,s3-eth1:None,s3-eth2:None,s3-eth3:None,s3-eth4:None pid=1904>
<Host h1: h1-eth0:10.0.0.1 pid=1898>
<Host h2: h2-eth0:10.0.0.2 pid=1899>
<Host h3: h3-eth0:10.0.0.3 pid=1900>
<Host h4: h4-eth0:10.0.0.4 pid=1901>

mininet> h1 ping h2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=5.33 ms
64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.253 ms
64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=0.070 ms
^C
--- 10.0.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.070/1.887/5.339/2.442 ms
mininet> h2 ping h1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
From 10.0.0.2 icmp_seq=1 Destination Host Unreachable
From 10.0.0.2 icmp_seq=2 Destination Host Unreachable
From 10.0.0.2 icmp_seq=3 Destination Host Unreachable
^C
--- 10.0.0.1 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3015ms
pipe 3
mininet>

Thank you in advance for any answers.本回答被提问者和网友采纳

如何修改Linux环境下的Oracle的IP地址配置?

某系统采用Oracle+RedHat Linux组建,系统已经架设成功,但近期该服务需要更换IP地址,已经通过修改Linux的/etc/hosts文件更改了操作系统的IP,如何更改Oracle中的相关配置呢??是不是要修改TNS配置,请教!

应该不需要,除非你的监听用的是IP而不是系统名称。你看下你的tnsnames.ora跟listener.ora的HOST是否用的是系统名。 参考技术A 修改,listener.ora 文件中ip,然后重新启动监听。

以上是关于如何在Mininet中修改host的IP地址的主要内容,如果未能解决你的问题,请参考以下文章

怎样在mininet的拓扑中修改控制器

如何修改Linux环境下的Oracle的IP地址配置?

如何将localhost的ip修改为其他地址

如何配置switchhosts

hosts文件该怎么设置?将IP地址与域名绑定的教程

如何修改hosts并保存