6 Replies Latest reply: Oct 3, 2012 10:27 PM by Ani RSS

    Find the linux interface gateway

    Ani
      HI,
      I want to find the gateway of interface bondeth4. From ifconfig o/p i can see that the ip is showing "10.217.49.23", & from /etc/sysconfig/network-scripts/ifcfg-bondeth4 the gateway is 10.217.202.1. But from route o/p the gateway is showing default gateway i.e 10.217.198.1. if u can help me to find out the current gateway of bondeth4

      Regards,
      Ani

      bondeth4 Link encap:Ethernet HWaddr 00:1B:21:89:94:A8
      inet addr:10.217.49.23  Bcast:10.217.63.255  Mask:255.255.240.0
      inet6 addr: fe80::21b:21ff:fe89:94a8/64 Scope:Link
      UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
      RX packets:22633138275 errors:0 dropped:0 overruns:0 frame:0
      TX packets:191215659214 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:1359571459915 (1.2 TiB) TX bytes:289246386937191 (263.0 TiB)

      ===================================================================
      [root@xxxxxxxx network-scripts]# route -n
      Kernel IP routing table
      Destination Gateway Genmask Flags Metric Ref Use Iface
      10.218.9.17 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
      10.217.201.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
      *10.217.202.0 0.0.0.0 255.255.255.0 U 0 0 0 bondeth4*
      10.217.199.0 0.0.0.0 255.255.255.0 U 0 0 0 bondib0
      10.217.198.0 0.0.0.0 255.255.255.0 U 0 0 0 bondeth0
      169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 bondib0
      0.0.0.0 10.217.198.1 0.0.0.0 UG 0 0 0 bondeth0
      [root@xxxxxxxx network-scripts]#
      ==========================================================
      [root@xxxxxxxx network-scripts]# cat ifcfg-bondeth4
      #### DO NOT REMOVE THESE LINES ####
      #### %GENERATED BY CELL% ####
      DEVICE=bondeth4
      USERCTL=no
      BOOTPROTO=none
      ONBOOT=yes
      IPADDR=10.217.49.23
      NETMASK=255.255.240.0
      #NETWORK=10.217.198.0
      #BROADCAST=10.217.198.255
      #BONDING_OPTS="mode=active-backup miimon=100 downdelay=5000 updelay=5000 num_grat_arp=100"
      BONDING_OPTS="mode=802.3ad miimon=100 lacp_rate=1"
      IPV6INIT=no
      GATEWAY=10.217.202.1
      [root@xxxxxxxx network-scripts]#
      ================================================================
      [root@xxxxxxxx network-scripts]# netstat -nr
      Kernel IP routing table
      Destination Gateway Genmask Flags MSS Window irtt Iface
      10.218.9.17 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
      10.217.201.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
      *10.217.202.0 0.0.0.0 255.255.255.0 U 0 0 0 bondeth4*
      10.217.199.0 0.0.0.0 255.255.255.0 U 0 0 0 bondib0
      10.217.198.0 0.0.0.0 255.255.255.0 U 0 0 0 bondeth0
      169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 bondib0
      0.0.0.0 10.217.198.1 0.0.0.0 UG 0 0 0 bondeth0
      [root@xxxxxxxx network-scripts]#
        • 1. Re: Find the linux interface gateway
          Catch 22
          You cannot find the gateway from looking at a tcp/ip address and network mask. It is usually the IP address of your router. Your IP and netmask defines a usable IP range of 10.217.48.1 to 10.217.63.254. Your default gateway will have to be within that range to be usable.
          • 2. Re: Find the linux interface gateway
            Ani
            Thanks Dude.
            Now i have some question

            1.i want yo change the ipaddress,subnetmask gateway of bondeth4.
            Is it possible to make it online?
            if yes what are those steps i have to follow.

            2. if online not possible then whats steps i need to follow.

            Regards,
            Ani
            • 3. Re: Find the linux interface gateway
              Catch 22
              You can edit the ifcfg-bondeth4 file and then type "service network restart" for the change to take affect.
              • 4. Re: Find the linux interface gateway
                Ani
                Thank you.but i don't want to make it down."service network restart" will restart all other interface. The below is my action plan. Please verify & let me know your concern.


                Current setting :-
                bondeth4-10.217.49.23 Mask:255.255.240.0 Gateway i am not able to find ?

                Requirement
                bondeth4-10.217.202.18/24 gw 10.217.202.1

                Action Plan:-

                #Ifconfig bondeth0 10.217.202.18 netmask 255.255.255.0 up.

                vi /etc/sysconfig/network-scripts/ifcfg-bondeth4
                IPADDR=10.217.202.18
                NETMASK=255.255.255.0
                GATEWAY=10.217.202.1

                Now what else require.Another thing, how i will add the gateway with this bondeth4. Because the new gw what i will mention in the ifcfg-bondeth4 will be effective when i will reboot the server or service network restart ..

                Regards,
                Ani
                • 5. Re: Find the linux interface gateway
                  Catch 22
                  Restarting the network service will not disrupt existing connections that use the same network settings. If you need to work with only a particular interface for experimenting without changing permanent settings, use the ifconfig and route command. For instance:

                  <pre>
                  ifconfig bondeth4 down
                  ifconfig bondeth4 10.217.202.18 netmask 255.255.255.0 up
                  route add default gw 10.217.202.1 bondeth4
                  </pre>
                  • 6. Re: Find the linux interface gateway
                    Ani
                    Thanks Dude.
                    Regards,
                    Ani