kraftydevil
kraftydevil

Reputation: 5246

Accessing Jenkins on Mac OS X from another machine

I want to reach Jenkins from both behind the router and the internet.

Pretty straightforward setup:

Internet > Router > Mac > Jenkins

Known items:

enter image description here

Goals

  1. I want to be able to access the Jenkins site from any machine already behind the router. I thought that I could use the X.X.X.X IP address as the above Jenkins URL but this didn't work.

  2. Second, I want to be able to reach the Jenkins site from outside the router. Then I can configure Jenkins anywhere as well as use web-hooks when there are changes.

    I assume I then need to know the IP address of the router but that's about all I know.

How can I accomplish this?

Upvotes: 3

Views: 5867

Answers (1)

kraftydevil
kraftydevil

Reputation: 5246

Here's how to connect to a Jenkins instance on Mac OS X from outside your router, although it's probably very similar on another OS like Windows or Linux.

  1. Give your Jenkins machine a static IP address in Settings. We'll refer to it as jenkins_machine_static_ip for the purposes of these instructions:

    • Go to Settings > Network > Advanced... > TCP/IP
    • Copy the IPv4 Address (it'll be your jenkins_machine_static_ip), and also copy the Subnet Mask, & Router
    • Select Configure IPv4 > Manually
    • Fill in copied info and select 'OK'
  2. In your router's admin panel, assign the same jenkins_machine_static_ip to the Mac Address of your Jenkins machine.

    Access to the router admin panel depends on your router.

    You can find your Mac Address on your Jenkins machine as follows:

    • Go to Settings > Network > Advanced... > Hardware
  3. Configure the Jenkins URL as http://jenkins_machine_static_ip:pick_a_port, where jenkins_machine_static_ip is the same one from steps 1&2 and pick_a_port is any unused port.

    • The Jenkins URL can be configured in your Jenkins web portal by following this path:
      Jenkins > Manage Jenkins > Configure System > Jenkins Location
    • See the image in the original question.
  4. Set up port forwarding on your router by picking an arbitrary router port (we'll call it router_forwarded_port) and forwarding it to http://machine_static_ip:pick_a_port, which you set up in #3.

You can now access your Jenkins instance from outside the network by accessing your router's IP and the forwarding port. You can get your router's external IP address here: Router_IP

The address you need to connect to is: Router_IP:router_forwarded_port/

Upvotes: 2

Related Questions