Thursday, October 10, 2013

Fun with Ubuntu 12.04 DNS and Static IP Address

So yesterday and today I've been having fun with a little problem with the latest Ubuntu 12.04 LTS server, and setting a static IP Address. The fun is that when you use a static address, you also need to include the DNS specification with it. I went the way of modifying the /etc/network/interfaces file to set my IP address. What I found out in the end is that the file has to look something like this:

# The primary network interface
auto eth0
iface eth0 inet static
    address 10.0.1.17
    netmask 255.255.255.0
    gateway 10.0.1.1
    network 10.0.1.0
    broadcast 10.0.1.255
    dns-search kingsleylocal.com
    dns-nameservers 10.0.1.14 208.67.220.220

The first 5 lines are normal for past Ubuntu versions, but the last two are new. So with 12.04, you need to specify the DNS nameservers by setting the line dns-nameservers and then the IP address of the servers that you want to use separated with a space. Then if you have a local domain as well, you can let the server know about it by dns-search and that will search you local network for matches. After I set this I modified /etc/resolv.conf, knowing that it would be replaced at reboot, but this is what I did, I edited the file and added nameserver 10.0.1.14 and saved it and verified that it was there. After doing that I could ping Google.com (where before without the two dns-* lines i couldn't ping Google.com). But then I knew that I needed to regenerate the resolv.conf file by running sudo resolvconf -u command and when I looked at resolv.conf, my line was gone. So I rebooted the server just to see what would happen and after it came up I could still ping Google.com. So I looked in my resolv.conf file and it had:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.0.1.14
nameserver 208.67.220.220
search kingsleylocal.com

So this is what I have learned about setting a static address on Ubuntu 12.04 LTS 64 bit server to get DNS to resolve.

Friday, November 2, 2012

Site Map and Competition Board



So yesterday I've starting two new projects that shouldn't take much time. The first one I've started is a site map for our main management site. What started me wanting to do this is the iPad and iOS 6. With this new iOS, the drop down menus don't work right like what I can do on my Android phone. You can tap on the menu, and go to that tap, but you cannot access anything that drops down. So I'm taking our header file and I'm going to create a site map that lists all links that are found in the header menus. So far I've striped out all the extra code I don't need and just have links in a table format. So right now it doesn't look pretty. But I'll keep everyone informed with how it goes, but I don't plan on spending much time on this at one time, more for when I need a break from other stuff.

The other project that I've started was a competition/tracking/motivation board on our sight to help keep our account managers motivated in filling spaces in our parks. With this they will be able to track the past weeks progress, whether it be good or bad, and see who did the best for the week. So the managers can put in what there totals where for each of the categories, and that will come up with a total points for the week. Now they have a chance to do a little challenge, like throwing a ball and making a goal, like into an empty trash basket, to earn higher points for the week. But it sounds like they will only get one chance to do it. If they make the goal, then they got the larger points for the week. But if they miss, then they lose all there points, and those points are divided up between all the other managers. Now each category has an x-factor to increase the total points if the bonus is made. So for each category, there are three things kept track of, the first one is what was your goal for that category for the week. Second is what did you achieve. The third is a bonus if you made your goal. So the goal section is worth no points, because its what you are striving to get. The second is worth one point for each home that meets that criteria. Then if the goal was made, then you get five additional points for that category. So things can add up if you set your goal and then make it. Then if you make the challenge of the day, then things can really add up. If the challenge is made, you get to apply the x-factor to the points for the second and third column. So this is what I have to create, and it will probably be done next week I hope. So far I've created the layout sort of with how I want it to look, then I'll need to do the back end math and data base back end for saving the different weeks.  So it doesn't sound like as much as I thought it would have been after talking about what I have done yesterday, and what I have to do, but we'll see.

Friday, October 19, 2012

Leaning with PBX in a Flash

So today I realized that the new PBX system wasn't secured from the outside world. The way we have things set up with it is eth0 is for the internal network, and eth1 is connected to the outside network, not being controlled by our firewall and DNS. That is where we connect to our SIP Trunk as well. So because of this, the phone system was a bit overly exposed to the cloud. So today I learned how to use WebMin and manage the IPTables that run on the system. So I changed a lot of rules to accept traffic only from eth0, thus locking out the outside world from some of the most easiest points of attack.

Then their was another thing that I found out today about the new system. It was using .htaccess lock to view voicemail. They tried to have admins add this back in March, but when I did, I didn't know my way around, and so I removed the locking file. But with this newer version, they had added it. So after spending lots of time trying to disable it, or find my way through it, I finally understood what the foram was saying for what to do about it. Here at http://www.pbxinaflash.com/community/index.php?threads/freepbx-2-10-latest-beta-voicemail-and-recordings-asks-for-auth-p-a-s-s-w-o-r-d.12407/ at about half way down where wardmundy is talking about what to do, it clicked what I needed to do. She gave the command to add a user for htaccess. She gave "htpasswd /usr/local/apache/p-a-s-s-w-d/wwwpasswd <username>". So I took that and started to enter it in and had to change it some. what I did was "htpasswd -bm /usr/local/apache/passwd/wwwpasswd <username> <password>" and that wrote a user in that file that I could share with everyone. So that was quite a learning experience for me, and a good one to know. 

Tuesday, October 16, 2012

Quick Report

So my boss today asked me if I could make a quick report that you can get to from the home page of our management site. So I touched up some of the things that the main page had, then created the page. Nothing new in it, but I did get to use the code I put for counting the days between two dates. Then I rounded that answer to 0 precision and then it gave me a number that looked clean and was whole days. Well, nothing much, but it's something. -Rob

Sunday, October 14, 2012

Sorry for the delay and updates

Sorry for not righting regularly like I had hoped and started out. It's a habit that I haven't developed yet. There has been some projects that I have been working on since the last time I posted anything. Some new things learned, but not that much has happened. One reason is that I normally can get about 8 to 12 work days a month to program. The rest of the time is support and closing books/ledgers to the next month and then cleaning things up so the reports can reflect what truly went on that month. There is a set list of things that I check each month, and then I'll fix them or find out why they are the way that they are. But starting the middle of last month, things started to change as far as responsibilities at work went. The reason is that my co-worker that also programed along with me got a job for Ancestry.com, and so that slowly made me the head of the IT department. So the beginning of this month, I started out as the head, and shortly after that, we hired some one new so we had two programmers in the office. Also I got a nice pay raise because of my position change. But my old responsibilities hasn't changed much yet. I'm in the process of acquiring someone new to do support full time. After that person (who ever it might be) starts, then I can focus more on directing and programing.

One thing that I have been working on this week is to start moving our VoIP system over to a physical computer to run on. One of the problems we have been having, and seems that it's not that uncommon with running the VoIP server on an VM is the jitter getting to be bad enough where the server has to re-sync the audio during a phone conversation. That means that there will be 3-5 seconds where audio cannot be heard one way or the other, or both parties cannot hear each other. We have tried to dedicate a whole processor to the VM, but that didn't fix the problem. So the next solution is to move to a physical box for the phone server. So this past week I got the hardware for it from NewEgg.com and put it together. Then Wednesday through Friday I have been working on it where I could to get it set to be the phone server for the office. So last week I got to the point where I feel comfortable to start configuring the actual PBX portion of the server this week. I'll try to keep everyone in the loop ask things go along. And I'll also try better to keep adding thing to this blog. -Rob

Thursday, March 8, 2012

Counting Days Difference using PHP

Sorry for not righting in here lately, not use to doing this, so here is something that I have learned this week. Have you ever wanted to find out how many days it has been between two days, well her is a way using PHP. I'll show the code I did, then I'll explain it.

$days = (strtotime($today) - strtotime($olderdate)) / (60 * 60 * 24);

Basically what has to happen is that you convert your dates to seconds with strtotime( ). Then subtract the two dates to get the difference between the two dates. The back half is 60 seconds times 60 minutes times 24 hours. That is 86400 seconds. So take your difference in dates and then divide that by the 86400 or 60 * 60 * 24. Now sometimes if the date has some information indicating time, and you only what to show days, then before you output, you will need to format to only show the number of days by encapsulate $days with number_format($days). This will only show the days without rounding the number.

I hope you enjoyed this little tid bit, thanks for reading.

Wednesday, February 15, 2012

Having fun with div tags

Today on my revamp of my first project, what I mainly did was change the basic layout from using tables to div's. The main content of this page is nested within tables that the framework is setup to use and div's for the accordion setup. What I ended up doing was setting my first div to be absolute to the page side, then build from there to be relative. This gave me a structure to bullet sections and then have the main content line up uniformly. Before it was using &nbsp; in a table cell to get things to work. This looks much better except for one line that is off compared to the rest. It's close enough for now (it's only a couple pixels to the left from everything else). So not much today.