• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    FOG 1.2.0 - WOL on multiple VLANs

    Scheduled Pinned Locked Moved
    FOG Problems
    4
    30
    13.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      Jacob Gallant
      last edited by

      Hello all,

      We recently upgraded from FOG 0.32 to 1.2.0.

      Our organization spans multiple VLANs (~30) and since the upgrade wake-on-LAN is no longer working. We haven’t changed anything on the networking side and it worked in 0.32. In order to get it to work we edited the wol.php file to add all of the VLAN broadcast IPs (X.X.X.255) but in 1.2.0 I don’t believe that is an option anymore. Or maybe it is and I’m just not seeing where.

      We have one main FOG server that sends out the magic packets and it is allowed to send these broadcasts on our router (as I said, it worked fine in 0.32 and nothing has changed on the network side). If I send a WOL packet using the wakeonlan command it doesn’t work if I leave it default (sending to 255.255.255.255) but if I change the IP to the broadcast IP of the VLAN it does work.

      Main FOG server info:
      Linux Mint 13 (64-bit)
      VMWare ESXi 5.1
      FOG 1.2.0

      1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott
        last edited by

        (title edited)

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • J
          Jacob Gallant
          last edited by

          Me again!

          After attempting a number of things in house we are no closer to an answer. I just wanted to add some context.

          Currently our routers allow our main FOG server to send directed broadcasts to all of our workstation VLAN broadcast IPs (X.X.X.255).

          In version 0.32 we followed this wiki in order to forward WOL packets to the seperate VLAN broadcast IPs: [url]http://www.fogproject.org/wiki/index.php/WOL_Forwarding[/url]. It seems that this was a home-built solution and that editing the wol.php file is a thing of the past (or at least it isn’t possible to do it the same way).

          Which brings me to the WakeOnLan.class.php file. I have extremely limited php knowledge so I’m not sure how this file works, but I can read comments as well as anyone and it clearly states that this is the file that builds the magic packet. Can anyone give me a brief breakdown on how it works and if editing is necessary to broadcast to VLAN broadcast IPs rather that 255.255.255.255?

          [PHP]<?php
          /** \class WakeOnLan
          Builds the magic packet needed for waking systems from LAN.
          */
          class WakeOnLan
          {
          private $strMac;

          /** __construct($mac)
              Stores the MAC of which to system to wake.
          */
          public function __construct( $mac )
          {
              $this->strMac = $mac;
          }
          
          /** send()
              Creates the packet and sends it to wake up the machine.
          */
          public function send()
          {
              if ( $this->strMac != null )
              {
                  $arByte = explode(':', $this->strMac);
          
                  $strAddr = null;
          
                  for ($i=0; $i<count( $arByte); $i++)
                      $strAddr .= chr(hexdec($arByte[$i]));
          
                  $strRaw = null;
                  for ($i=0; $i<6; $i++)
                      $strRaw .= chr(255);
          
                  for ($i=0; $i<16; $i++)
                      $strRaw .= $strAddr;
          
                  $soc = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
                  if ( $soc !== FALSE )
                  {
                      if(socket_set_option($soc, SOL_SOCKET, SO_BROADCAST, TRUE))
                      {
                          if( socket_sendto($soc, $strRaw, strlen($strRaw), 0, "255.255.255.255", 9) )
                          {
                              socket_close($soc);
                              return true;
                          }
                          else
                              return false; 
                      }
                      else
                          new Exception( "Failed to set option!"); 
                  }
                  else
                  {
                      $errCd = socket_last_error();
                      $errMsg = socket_strerror($errCd);
                      throw new Exception( "Socket Error: $errCd :: $errMsg" );
                  }
              }
              return false;
          }
          

          }[/PHP]

          We are currently between web developers here or I would ask him/her to give me a quick tutorial. Any help would be greatly appreciated!

          Jacob

          1 Reply Last reply Reply Quote 0
          • Tom ElliottT
            Tom Elliott
            last edited by

            There should be no need for editing this file of any context.

            As you have VLAN’s, your switches should be simply set to allow ip-broadcast-forwarding particularly across UDP port #9.

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            1 Reply Last reply Reply Quote 0
            • J
              Jacob Gallant
              last edited by

              Thanks Tom! I’ll check on our switch configs and post back.

              1 Reply Last reply Reply Quote 0
              • J
                Jacob Gallant
                last edited by

                Just an update: capturing packets on the same VLAN as the FOG server revealed that it is indeed sending out WOL packets to the destination IP 255.255.255.255. They are not travelling any further than the router however, as we don’t see them on any other VLAN.

                We dug into this article: [URL=‘http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipapp/configuration/12-4/iap-12-4-book/iap-bph.html’][FONT=Calibri]http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipapp/configuration/12-4/iap-12-4-book/iap-bph.html[/FONT][/URL], tried to set ip helper-addresses and the like but still nothing. We even attempted allowing UDP broadcast flooding and still a no go. Everything else pertaining to that document is enabled (access lists, forward UDP port 9 enabled, ip directed broadcast enabled on VLANs, helper-addresses as mentioned).

                We’re really at a loss. Anything jump out at anybody? I realize this isn’t a FOG issue per se just looking for some friendly advice.

                Thanks!

                1 Reply Last reply Reply Quote 0
                • F
                  Fernando Gietz Developer
                  last edited by

                  The problem is the broacast direction. Actually, I’m trying to solve this problem. We have computers in different vlans and his broadcast IP are not 255.255.255.255. The problem are the wakeOnLan function in FOGCORE.class.php, MACAddress.class.php, WakeOnLan.class.php and wol.php file. You need pass the broadcast ip of the vlan to create wellthe magic packet.

                  :eek:

                  1 Reply Last reply Reply Quote 0
                  • J
                    Jacob Gallant
                    last edited by

                    OK sure, that makes sense. It seems like that was what was done with the workaround mentioned in the wiki above, although it was very much a messy solution (going through each VLAN one by one and sending a WOL packet to each VLAN broadcast IP).

                    1 Reply Last reply Reply Quote 0
                    • Tom ElliottT
                      Tom Elliott
                      last edited by

                      There is a way to do this without changing the code in the WakeOnLan class.

                      How do I know this?

                      Because We have 12 separate vlan’s.

                      Each vlan is within it’s own subnet of course (though all vlan’s have the same subnet.)

                      The fix for us, was from our routing switch, we had to enable ip-broadcast-forward :

                      We did it from the “central” routing switch:
                      We have HP Procurve switches.

                      The way we did it for the hp procurve (should be very similar for cisco).

                      1. Telnet, or ssh into the switch and provide any passwords.

                      2. At the prompt enter [code]configure[/code]

                      3. Enable UDP broadcast forwarding globally [code]ip udp-bcast-forward[/code]
                        This simply allows you to forward UDP broadcast as you specify later.

                      4. Figure out what UDP port fog is trying to use to do Wake on LAN with either wireshark or some other packet monitoring tool. FOG, by default, uses UDP port 9.

                      5. Enter the vlan conext for the SERVER’s vlan (aka the FOG Server’s vlan.) For us it’s on vlan 75.
                        [code]vlan 75[/code]

                      6. From the particular vlan context enable the ip forwarding for udp with port for the DESTINATION subnet you want the WAKE on lan to operate on: For our example the vlan is 10.125.0.0 with a broadcast of 10.125.255.255
                        [code]ip forward-protocol udp 10.125.255.255 9[/code]

                      7. Repeat the command for each of the other VLAN’s you need setup wake on lan for.
                        NOTE: You do not need to run the command for the vlan where the fog server resides as it’s layer 2 and should already work for wake on lan.

                      8. save the config’s and log out of the routing switch.

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                      1 Reply Last reply Reply Quote 0
                      • J
                        Jacob Gallant
                        last edited by

                        Hi Tom,

                        Unfortunately with Cisco ip forward-protocol is a global setting only, it’s not available at the VLAN level in order to configure the VLAN broadcast IP.

                        We have other systems within our organization that use subnet-directed WOL and they work fine with no config changes. One in particular I know uses dns lookups to determine the IP based on the hostname and sends to the VLAN broadcast IP based on that. And like I mentioned before when using wakeonlan with the -i switch and the VLAN broadcast IP from the FOG server it works as well.

                        Jacob

                        1 Reply Last reply Reply Quote 0
                        • Tom ElliottT
                          Tom Elliott
                          last edited by

                          Does this article not help?
                          [url]https://supportforums.cisco.com/discussion/11601376/wake-lan-wol-across-different-vlans-sg-300-10[/url]
                          or
                          [url]http://www.cisco.com/c/en/us/support/docs/switches/catalyst-3750-series-switches/91672-catl3-wol-vlans.html[/url]

                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                          1 Reply Last reply Reply Quote 0
                          • J
                            Jacob Gallant
                            last edited by

                            Unfortunately no. The first one refers to UDP relay which is not an option on our particular router. And the second article is exactly how we have things set up, but no go. It appears that the router is discarding broadcasts to 255.255.255.255 whereas subnet-directed broadcasts are working properly.

                            Jacob

                            1 Reply Last reply Reply Quote 0
                            • F
                              Fernando Gietz Developer
                              last edited by

                              Hi Tom,

                              we have 40 differents vlans which mask isn’t 24. Also, we can not manage the network; because that work is done by another department 😛

                              We may match the IP address with the broadcast address of the subnet. We put this relationship into wakeOnLan function, isn’t the best solution, but works.

                              1 Reply Last reply Reply Quote 0
                              • Tom ElliottT
                                Tom Elliott
                                last edited by

                                Okay.

                                I’ll see about what I can do to help.

                                WOL, in 1.0.0, wasn’t really written by me either. But if you’ve taken a look at the /var/www/fog/lib/fog/WakeOnLan.class.php file, you’ll notice we’re not relying on a program to be executed to do wake on lan any more.

                                I’d be interested in figuring out a fail proof method in cisco and place that in the wiki as it really can’t be this hard.

                                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                1 Reply Last reply Reply Quote 0
                                • Tom ElliottT
                                  Tom Elliott
                                  last edited by

                                  More links that may help.

                                  Remember, as far as I can tell, you only need to make the changes at the “central” switch/router as it’s handling the routing of any said traffic.

                                  @Fernando, while you have many vlan’s and you guys don’t control the networking, maybe having one of the heads of that department take a look could help?

                                  I realize customizing these things would help, it’s also a bit unwieldy to try making a programmatic solution too. Having you do your own code works too, but you lose those changes in future updates. Seeing as so much changed between 0.32 and 1.x.x, I imagine it’s not always going to be easy. That said, we could think about making a plugin that deals with VLAN Wake on lan.

                                  I don’t know where to start with it, but it can’t be too difficult. Try the regular Wake on lan, if that doesn’t work, enable the plugin, then that plugin Wake On lan system does the work. It would require you to install the wakeonlan package though.

                                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                  1 Reply Last reply Reply Quote 0
                                  • F
                                    Fernando Gietz Developer
                                    last edited by

                                    I think that make a wakeOnLan plugin will be a good solution. If you want, I can develope it … I need it 🙂

                                    It’s easy, and the code changes are littles. The “big” problem is how manage the different broadcast directions. Actually, those relationships are “saved” in the code.

                                    [PHP]function wakeOnLan( $mac, $ipHost=null)
                                    {
                                    if ($ipHost != null)
                                    {
                                    list($ip1, $ip2, $ip3, $ip4) = explode(“.”, $ipHost);
                                    $subnet=$ip1 . “.” . $ip2 . “.” . $ip3;

                                                if ( getSetting( $conn, "FOG_WOL_BCAST" ) == "" )
                                                        switch ($subnet) {
                                    

                                    ##########################################################################
                                    ####### Here you must to write the broadcast IPs
                                    ##########################################################################
                                    case “10.227.34”: $ipBroadcast = “10.227.35.255”; break;
                                    case “10.227.84”: $ipBroadcast = “10.227.87.255”; break;
                                    case “10.227.85”: $ipBroadcast = “10.227.87.255”; break;
                                    case “10.227.15”: $ipBroadcast = “10.227.15.31”; break;
                                    #########################################################################
                                    default: $ip = $ip1 . “.” . $ip2 . “.” . $ip3 . “.” . “255”;
                                    // default: $ipBroadcast = “255.255.255.255”;
                                    } else $ipBroadcast = getSetting( $conn, “FOG_WOL_BCAST” );
                                    …
                                    [/PHP]

                                    I would like manage them from the webUI

                                    1 Reply Last reply Reply Quote 0
                                    • J
                                      Jacob Gallant
                                      last edited by

                                      [quote=“Fernando Gietz, post: 37878, member: 13”]We may match the IP address with the broadcast address of the subnet. We put this relationship into wakeOnLan function, isn’t the best solution, but works.[/quote]

                                      Fernando - just wondering where you would get the IP address you’re referring to? Just given that computers can and do change subnets fairly often in our environment, so the last IP of the workstation isn’t necessarily correct.

                                      1 Reply Last reply Reply Quote 0
                                      • Tom ElliottT
                                        Tom Elliott
                                        last edited by

                                        The idea of the “plugin” would be to create a management page for WOL that you simply specify the broadcast addresses you need.

                                        If you guys want to try:

                                        maybe edit the 255.255.255.255 part of the WakeOnLan .class.php file and put it to your broadcast as in the post above?

                                        (10.155.255.255) and see if that works?

                                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                        1 Reply Last reply Reply Quote 0
                                        • F
                                          Fernando Gietz Developer
                                          last edited by

                                          This IP is the IP of the host, and you can get it from the DB. In the hosts table, there is a atribute hostIP.

                                          From “Create new host” submenu in the webUI you can not enter the IP address , but if you import the computers, you can enter the IP address.

                                          For example:
                                          Host 1: IP 10.227.15.25 -> subnet direction: 10.227.15 -> broadcast IP is 10.227.15.31 (and not 10.227.15.255, with this direcction doesn’t work)

                                          You can test the Tom’s solution 🙂

                                          1 Reply Last reply Reply Quote 0
                                          • F
                                            Fernando Gietz Developer
                                            last edited by

                                            [quote=“Tom Elliott, post: 37895, member: 7271”]The idea of the “plugin” would be to create a management page for WOL that you simply specify the broadcast addresses you need.

                                            If you guys want to try:

                                            maybe edit the 255.255.255.255 part of the WakeOnLan .class.php file and put it to your broadcast as in the post above?

                                            (10.155.255.255) and see if that works?[/quote]

                                            It works 🙂 . I change the broadcast 255.255.255.255 to 10.227.15.31

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post

                                            176

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project