Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12606 Discussions

How to deal with the route in Linux

Altera_Forum
Honored Contributor II
2,885 Views

the next figure is my network  

 

----<--Extern Network(ADSL module)(IP base : 192.168.1.1 netmask 255.255.255.0 --> 

|______><Route (IP base 192.168.2.1 netmask 255.255.255.0)>--> 

___><my PC IP : 192.168.2.102 netmask 255.255.255.0> 

|_><my EP2C35 Board> 

 

NOW, I have install a FTP seriver in my Pc. I want to transfer a file from the pc to my board 

 

(ep2c35 dev kit) 

so first i config the IP  

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# ifconfig eth0 192.168.2.12 eth0 

eth0:PHY 100BaseT 

eth0:PHY Full Duplex[/b] 

--- Quote End ---  

 

ok I find it can&#39;t connect when I ping my PC  

 

so i check the information of route. 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# route 

Kernel IP routing table 

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 

192.168.2.0     *               255.255.255.0   U     0      0        0 eth0 

127.0.0.0       *               255.0.0.0       U     0      0        0 lo 

I don&#39;t konw how to change  the IP(192.168.2.0) of eth0 to 192.168.2.1) 

so i had to add a route .but i got a errors . # route add 192.168.1.1 gw 192.168.2.1 netmask 255.255.255.0 eth0 

route: netmask 000000ff and host route conflict# [/b] 

--- Quote End ---  

 

if i don&#39;t care the netmask . the netmask will become to "255.255.255.255". 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# route add 192.168.1.1 gw 192.168.2.1 eth0# route 

Kernel IP routing table 

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 

192.168.1.1     192.168.2.1     255.255.255.255 UGH   0      0        0 eth0 

192.168.2.0     *               255.255.255.0   U     0      0        0 eth0 

127.0.0.0       *               255.0.0.0       U     0      0        0 lo# [/b] 

--- Quote End ---  

 

can you tell me ! how to deal with it . thanks !
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
1,570 Views

do you config your board as following?  

ifconfig eth0 192.168.2.12 eth0 

 

you can use "ifconfig eth0 192.168.2.12". 

 

if the two device in the same subnet. The ip pocket won&#39;t transmit through the route
0 Kudos
Altera_Forum
Honored Contributor II
1,570 Views

enable this in in networking options of kernel config, and read the help of this , about ip forwarding, 

[* ] IP: advanced router
0 Kudos
Altera_Forum
Honored Contributor II
1,570 Views

HI hippo  

I have select the next config  

[* ] IP: advanced router 

 

but now i find a strange things . when i use the next command in my PC (win-xp) 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

C:\Documents and Settings\alexliu>ping 192.168.2.12 

 

Pinging 192.168.2.12 with 32 bytes of data: 

 

Reply from 192.168.2.12: bytes=32 time<1ms TTL=64 

Reply from 192.168.2.12: bytes=32 time<1ms TTL=64 

Reply from 192.168.2.12: bytes=32 time<1ms TTL=64 

Reply from 192.168.2.12: bytes=32 time<1ms TTL=64 

 

Ping statistics for 192.168.2.12: 

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 

Approximate round trip times in milli-seconds: 

    Minimum = 0ms, Maximum = 0ms, Average = 0ms[/b] 

--- Quote End ---  

 

but I use the next command in my Board (EP2C35) 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# ping 192.168.2.102 

PING 192.168.2.102 (192.168.2.102): 56 data bytes 

 

--- 192.168.2.101 ping statistics --- 

6 packets transmitted, 0 packets received, 100% packet loss# ping 192.168.2.1 

PING 192.168.2.1 (192.168.2.1): 56 data bytes 

84 bytes from 192.168.2.1: icmp_seq=0 ttl=128 time=10.0 ms 

84 bytes from 192.168.2.1: icmp_seq=1 ttl=128 time=0.0 ms 

84 bytes from 192.168.2.1: icmp_seq=2 ttl=128 time=0.0 ms 

84 bytes from 192.168.2.1: icmp_seq=3 ttl=128 time=0.0 ms 

84 bytes from 192.168.2.1: icmp_seq=4 ttl=128 time=0.0 ms 

 

--- 192.168.2.1 ping statistics --- 

5 packets transmitted, 5 packets received, 0% packet loss 

round-trip min/avg/max = 0.0/2.0/10.0 ms[/b] 

--- Quote End ---  

 

so I cann&#39;t find the reason . why I can connect the router(192.168.2.1) but when i connect my pc(192.168.2.102) ,i cann&#39;t connect it .
0 Kudos
Altera_Forum
Honored Contributor II
1,570 Views

but you said your PC&#39;s IP is 192.168.2.102 ? not 192.168.1.101?

0 Kudos
Altera_Forum
Honored Contributor II
1,570 Views

 

--- Quote Start ---  

originally posted by hippo@Mar 15 2006, 10:03 AM 

but you said your pc&#39;s ip is 192.168.2.102 ? not 192.168.1.101? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=13437) 

--- quote end ---  

 

--- Quote End ---  

 

sorry ,because my PC &#39;s IP be assign by the route(192.168.2.1), so it maybe beccome to 192.168.2.101.  

 

I don&#39;t Know Why can&#39;t ping the PC , I thinks the network should be can work.
0 Kudos
Altera_Forum
Honored Contributor II
1,570 Views

ifconfig eth0 192.168.2.12 route add default gw 192.168.2.1

0 Kudos
Altera_Forum
Honored Contributor II
1,570 Views

Now I input the next command 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

127.0.0.0       *               255.0.0.0       U     0      0        0 lo# ifconfig eth0 192.168.2.12 

Heth0:PHY 100BaseT 

eth0:PHY Full Duplex# route -n 

Kernel IP routing table 

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0 

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo[/b] 

--- Quote End ---  

 

i add the route 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# route add default gw 192.168.2.1# route -n 

Kernel IP routing table 

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0 

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo 

0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 eth0[/b] 

--- Quote End ---  

 

when i input the ping  

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# ping 192.168.2.102 

PING 192.168.2.102 (192.168.2.102): 56 data bytes 

 

--- 192.168.2.102 ping statistics --- 

3 packets transmitted, 0 packets received, 100% packet loss# ping 192.168.2.1 

PING 192.168.2.1 (192.168.2.1): 56 data bytes 

84 bytes from 192.168.2.1: icmp_seq=0 ttl=128 time=10.0 ms 

84 bytes from 192.168.2.1: icmp_seq=1 ttl=128 time=0.0 ms 

84 bytes from 192.168.2.1: icmp_seq=2 ttl=128 time=0.0 ms 

 

--- 192.168.2.1 ping statistics --- 

3 packets transmitted, 3 packets received, 0% packet loss 

round-trip min/avg/max = 0.0/3.3/10.0 ms# [/b] 

--- Quote End ---  

 

 

in my computer  

I input the ipconfig  

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Ethernet adapter &#26412;&#22320;&#36830;&#25509;: 

 

        Connection-specific DNS Suffix  . : private 

        IP Address. . . . . . . . . . . . : 192.168.2.102 

        Subnet Mask . . . . . . . . . . . : 255.255.255.0 

        Default Gateway . . . . . . . . . : 192.168.2.1[/b] 

--- Quote End ---  

 

so I ping the board 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

C:\Documents and Settings\alexliu>ping 192.168.2.12 

 

Pinging 192.168.2.12 with 32 bytes of data: 

 

Reply from 192.168.2.12: bytes=32 time=1ms TTL=64 

Reply from 192.168.2.12: bytes=32 time<1ms TTL=64 

Reply from 192.168.2.12: bytes=32 time<1ms TTL=64 

Reply from 192.168.2.12: bytes=32 time<1ms TTL=64 

 

Ping statistics for 192.168.2.12: 

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 

Approximate round trip times in milli-seconds: 

    Minimum = 0ms, Maximum = 1ms, Average = 0ms[/b] 

--- Quote End ---  

 

 

it very strange . I don&#39;t know how to deal with the problem . pls help me ! 

thanks !!!
0 Kudos
Altera_Forum
Honored Contributor II
1,570 Views

Maybe it is the firewall on your xp, that blocks the ping. 

 

Can you ping outside your router from nios2?
0 Kudos
Altera_Forum
Honored Contributor II
1,570 Views

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Can you ping outside your router from nios2?[/b] 

--- Quote End ---  

 

what&#39;s means? 

I can ping outside in NIOS2  

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# ping 192.168.2.1 

PING 192.168.2.1 (192.168.2.1): 56 data bytes 

84 bytes from 192.168.2.1: icmp_seq=0 ttl=128 time=10.0 ms 

84 bytes from 192.168.2.1: icmp_seq=1 ttl=128 time=0.0 ms 

84 bytes from 192.168.2.1: icmp_seq=2 ttl=128 time=0.0 ms 

 

--- 192.168.2.1 ping statistics --- 

3 packets transmitted, 3 packets received, 0% packet loss[/b] 

--- Quote End ---  

 

 

but it only ping the 192.168.2.1 or 

when we have a another pc in the network(ip:192.169.2.100) 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# ping 192.168.2.100 

PING 192.168.2.100 (192.168.2.100): 56 data bytes 

84 bytes from 192.168.2.100: icmp_seq=0 ttl=128 time=0.0 ms 

84 bytes from 192.168.2.100: icmp_seq=1 ttl=128 time=0.0 ms 

 

--- 192.168.2.100 ping statistics --- 

2 packets transmitted, 2 packets received, 0% packet loss 

round-trip min/avg/max = 0.0/0.0/0.0 ms# [/b] 

--- Quote End ---  

 

my pc maybe have some problem. 

I will check it !
0 Kudos
Reply